[−][src]Struct honeybadger::ConfigBuilder
Configuration builder struct, used for building a Config
instance
Methods
impl ConfigBuilder
[src]
pub fn new(api_token: &str) -> Self
[src]
Construct a ConfigBuilder
to parametrize the Honeybadger client.
ConfigBuilder
is populated using environment variables, which will inject
Honeybadger event fields:
HONEYBADGER_ROOT
- project root for each event.ENV
- environment name for each event.HOSTNAME
- host name for each event.HONEYBADGER_ENDPOINT
- override the default endpoint for the HTTPS client.HONEYBADGER_TIMEOUT
- write timeout for the Honeybadger HTTPS client.
Arguments
api_token
- API key for the honeybadger project
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token);
pub fn with_root(self, project_root: &str) -> Self
[src]
Override the project root property for events posted to the Honeybadger API. Consumes the
ConfigBuilder
and returns a new value.
Arguments
project_root
- The directory where your code lives.
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token).with_root("/tmp/my_project_root");
pub fn with_env(self, environment: &str) -> Self
[src]
Add an environment name property for events posted to the Honeybadger API, which will then
be categorized accordingly in the UI. Consumes the ConfigBuilder
and returns a new
value.
Arguments
environment
- The directory where your code lives.
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token).with_env("production");
pub fn with_hostname(self, hostname: &str) -> Self
[src]
Override the hostname property for events posted to the Honeybadger API. Consumes the
ConfigBuilder
and returns a new value.
Arguments
hostname
- The server's hostname
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token).with_hostname("localhost");
pub fn with_endpoint(self, endpoint: &str) -> Self
[src]
Override the Honeybadger endpoint used to post HTTP payloads. Consumes the ConfigBuilder
and returns a new value.
Arguments
endpoint
- A custom honeybadger endpoint to query
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token).with_endpoint("http://proxy.example.com:5050/");
pub fn with_timeout(self, timeout: &Duration) -> Self
[src]
Override the HTTP write timeout for the client used to post events to Honeybadger.
Consumes the ConfigBuilder
and returns a new value.
Arguments
timeout
- ADuration
reference specifying the HTTP timeout for the write request
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token).with_timeout(&Duration::new(20, 0));
pub fn with_threads(self, threads: usize) -> Self
[src]
Override the number of threads the async HTTP connection should use to queue Honeybadger
payloads. Consumes the ConfigBuilder
and returns a new reference.
Arguments
threads
- The number of threads to configure the hyper connector
Example
let api_token = "ffffff"; let config = ConfigBuilder::new(api_token).with_threads(8);
pub fn build(self) -> Config
[src]
Prepare a Config
instance for constructing a Honeybadger instance.
Defaults are set if the ConfigBuilder
used to construct the Config
is empty.
- default root: the current directory
- default hostname: the host name as reported by the operating system
- default endpoint:
https://api.honeybadger.io/v1/notices
- default timeout: a 5 second client write timeout
- default threads: 4 threads are used in the asynchronous runtime pool
Example
ConfigBuilder::new(api_token).build();
Auto Trait Implementations
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,