[][src]Struct honeybadger::ConfigBuilder

pub struct ConfigBuilder { /* fields omitted */ }

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 - A Duration 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

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T