[][src]Struct ackorelic::NewRelicConfig

#[must_use]
pub struct NewRelicConfig<'a> { /* fields omitted */ }

Custom configuration used to connect to the New Relic daemon.

This only needs to be used if the New Relic daemon is running at a non-default location, or a different timeout is desired

Example:

use std::time::Duration;

use newrelic::{NewRelicConfig, LogOutput, LogLevel};

NewRelicConfig::default()
    .socket("/tmp/newrelic-alternative.sock")
    .timeout(Duration::from_millis(10000))
    .init()
    .expect("Could not connect to daemon!");

Methods

impl<'a> NewRelicConfig<'a>[src]

pub fn socket(self, socket: &'a str) -> Self[src]

Set the socket address used to connect to the New Relic daemon.

Generally, this function only needs to be called explicitly if the daemon socket location needs to be customised. By default, "/tmp/.newrelic.sock" is used, which matches the default socket location used by newrelic-daemon if one isn't given.

On Linux, if this starts with a literal '@', then this is treated as the name of an abstract domain socket instead of a filesystem path.

Examples:

use newrelic::NewRelicConfig;

NewRelicConfig::default()
    .socket("/tmp/.newrelic-alternative.sock")
    .init();

pub fn timeout(self, timeout: Duration) -> Self[src]

Set the amount of time that the SDK will wait for a response from the daemon before considering initialization to have failed. If this is 0 or unset then the SDK's default value will be used.

Example:

use std::time::Duration;

use newrelic::NewRelicConfig;

NewRelicConfig::default()
    .timeout(Duration::from_millis(10000))
    .init();

pub fn logging(self, level: Level, output: LogOutput<'a>) -> Self[src]

Configure logging for the New Relic SDK.

Defaults to LogLevel::Info and LogOutput::StdErr.

Note that this differs to the logs of the New Relic daemon, which are output by the daemon itself.

Examples:

Logging to stderr:

use newrelic::{NewRelicConfig, LogLevel, LogOutput};

NewRelicConfig::default()
    .logging(LogLevel::Debug, LogOutput::StdErr)
    .init();

Logging to a file:

use std::path::Path;

use newrelic::{NewRelicConfig, LogLevel, LogOutput};

NewRelicConfig::default()
    .logging(LogLevel::Debug, LogOutput::File(Path::new("test.txt")))
    .init();

pub fn init(self) -> Result<()>[src]

Initialise the New Relic SDK.

If non-default settings are to be used, this must be called before the first App is created.

Example:

use std::path::Path;
use newrelic::{NewRelicConfig, LogLevel, LogOutput};

NewRelicConfig::default()
    .logging(LogLevel::Info, LogOutput::File(Path::new("test.txt")))
    .init();

Trait Implementations

impl<'a> Default for NewRelicConfig<'a>[src]

Auto Trait Implementations

impl<'a> Sync for NewRelicConfig<'a>

impl<'a> Send for NewRelicConfig<'a>

impl<'a> Unpin for NewRelicConfig<'a>

impl<'a> RefUnwindSafe for NewRelicConfig<'a>

impl<'a> UnwindSafe for NewRelicConfig<'a>

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> IntoSql for T[src]

fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, 
[src]

Convert self to an expression for Diesel's query builder. Read more

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
    &'a Self: AsExpression<T>, 
[src]

Convert &self to an expression for Diesel's query builder. Read more