[−][src]Struct sentry_contrib_native::Options
Implementations
impl Options
[src]
#[must_use]pub fn new() -> Self
[src]
pub fn set_transport<S: FnOnce(&Self) -> T + 'static + Send + Sync, T: Into<Box<T>> + Transport>(
&mut self,
startup: S
)
[src]
&mut self,
startup: S
)
Sets a custom transport. This only affects events sent through
Event::capture
, not the crash handler.
The startup
parameter is a function that serves as a one-time
initialization event for your Transport
, it takes a
&Options
and has to return a Transport
.
Notes
Unwinding panics of functions in transport
will be cought and
abort
will be called if any occured.
Examples
let mut options = Options::new(); options.set_transport(|_| { |envelope: RawEnvelope| println!("Event to be sent: {:?}", envelope.event()) });
See Transport
for a more detailed documentation.
pub fn set_before_send<B: Into<Box<B>> + BeforeSend>(&mut self, before_send: B)
[src]
Sets a callback that is triggered before sending an event through
Event::capture
.
Notes
Unwinding panics of functions in before_send
will be cought and
abort
will be called if any occured.
Examples
let mut options = Options::new(); options.set_before_send(|mut value| { // do something with the value and then return it value });
pub fn set_dsn<S: Into<String>>(&mut self, dsn: S)
[src]
Sets the DSN.
Panics
Panics if dsn
contains any null bytes.
Examples
let mut options = Options::new(); options.set_dsn("yourdsn.com");
#[must_use]pub fn dsn(&self) -> Option<&str>
[src]
Gets the DSN.
Examples
let mut options = Options::new(); options.set_dsn("yourdsn.com"); assert_eq!(Some("yourdsn.com"), options.dsn());
pub fn set_sample_rate(&mut self, sample_rate: f64) -> Result<(), Error>
[src]
Sets the sample rate, which should be a f64
between 0.0
and 1.0
.
Sentry will randomly discard any event that is captured using Event
when a sample rate < 1.0 is set.
Errors
Fails with Error::SampleRateRange
if sample_rate
is smaller than
0.0
or bigger than 1.0
.
Examples
let mut options = Options::new(); options.set_sample_rate(0.5);
#[must_use]pub fn sample_rate(&self) -> f64
[src]
Gets the sample rate.
Examples
let mut options = Options::new(); options.set_sample_rate(0.5)?; assert_eq!(0.5, options.sample_rate());
pub fn set_release<S: Into<String>>(&mut self, release: S)
[src]
Sets the release.
Panics
Panics if release
contains any null bytes.
Examples
let mut options = Options::new(); options.set_release("1.0");
#[must_use]pub fn release(&self) -> Option<&str>
[src]
Gets the release.
Examples
let mut options = Options::new(); options.set_release("1.0"); assert_eq!(Some("1.0"), options.release());
pub fn set_environment<S: Into<String>>(&mut self, environment: S)
[src]
Sets the environment.
Panics
Panics if environment
contains any null bytes.
Examples
let mut options = Options::new(); options.set_environment("production");
#[must_use]pub fn environment(&self) -> Option<&str>
[src]
Gets the environment.
Examples
let mut options = Options::new(); options.set_environment("production"); assert_eq!(Some("production"), options.environment());
pub fn set_distribution<S: Into<String>>(&mut self, distribution: S)
[src]
Sets the distribution.
Panics
Panics if distribution
contains any null bytes.
Examples
let mut options = Options::new(); options.set_distribution("release-pgo");
#[must_use]pub fn distribution(&self) -> Option<&str>
[src]
Gets the distribution.
Examples
let mut options = Options::new(); options.set_distribution("release-pgo"); assert_eq!(Some("release-pgo"), options.distribution());
pub fn set_http_proxy<S: Into<String>>(&mut self, proxy: S)
[src]
Configures the http proxy.
Panics
Panics if proxy
contains any null bytes.
Examples
let mut options = Options::new(); options.set_http_proxy("1.1.1.1");
#[must_use]pub fn http_proxy(&self) -> Option<&str>
[src]
Returns the configured http proxy.
Examples
let mut options = Options::new(); options.set_http_proxy("1.1.1.1"); assert_eq!(Some("1.1.1.1"), options.http_proxy());
pub fn set_ca_certs<S: Into<String>>(&mut self, path: S)
[src]
Configures the path to a file containing SSL certificates for verification.
Panics
Panics if path
contains any null bytes.
Examples
let mut options = Options::new(); options.set_ca_certs("certs.pem");
#[must_use]pub fn ca_certs(&self) -> Option<&str>
[src]
Returns the configured path for CA certificates.
Examples
let mut options = Options::new(); options.set_ca_certs("certs.pem"); assert_eq!(Some("certs.pem"), options.ca_certs());
pub fn set_debug(&mut self, debug: bool)
[src]
Enables or disables debug printing mode.
Examples
let mut options = Options::new(); options.set_debug(true);
#[must_use]pub fn debug(&self) -> bool
[src]
Returns the current value of the debug flag.
Examples
let mut options = Options::new(); options.set_debug(true); assert!(options.debug());
pub fn set_logger<L: Into<Box<L>> + Fn(Level, Message) + 'static + Send + Sync>(
&mut self,
logger: L
)
[src]
&mut self,
logger: L
)
Sets a callback that is used for logging purposes when
Options::debug
is true
.
Notes
Unwinding panics in logger
will be cought and abort
will be called if any occured.
Examples
let mut options = Options::new(); options.set_debug(true); options.set_logger(|level, message| { println!("[{}]: {}", level, message); });
pub fn set_require_user_consent(&mut self, val: bool)
[src]
Enables or disabled user consent requirements for uploads.
This disables uploads until the user has given the consent to the SDK.
Consent itself is given with user_consent_give
and revoked with
user_consent_revoke
.
Examples
let mut options = Options::new(); options.set_require_user_consent(true);
#[must_use]pub fn require_user_consent(&self) -> bool
[src]
Returns true
if user consent is required.
Examples
let mut options = Options::new(); options.set_require_user_consent(true); assert!(options.require_user_consent());
pub fn set_symbolize_stacktraces(&mut self, val: bool)
[src]
Enables or disables on-device symbolication of stack traces.
This feature can have a performance impact, and is enabled by default on Android. It is usually only needed when it is not possible to provide debug information files for system libraries which are needed for serverside symbolication.
Examples
let mut options = Options::new(); options.set_symbolize_stacktraces(true);
#[must_use]pub fn symbolize_stacktraces(&self) -> bool
[src]
Returns true
if on-device symbolication of stack traces is enabled.
Examples
let mut options = Options::new(); options.set_symbolize_stacktraces(true); assert!(options.symbolize_stacktraces());
pub fn add_attachment<S: Into<String>, P: Into<PathBuf>>(
&mut self,
name: S,
path: P
)
[src]
&mut self,
name: S,
path: P
)
Adds a new attachment to be sent along.
Panics
Panics if name
or path
contain any null bytes.
Examples
let mut options = Options::new(); options.add_attachment("test attachment", "server.log");
pub fn set_handler_path<P: Into<PathBuf>>(&mut self, path: P)
[src]
Sets the path to the crashpad handler if the crashpad backend is used.
The path defaults to the crashpad_handler
/crashpad_handler.exe
executable, depending on platform, which is expected to be present in
the same directory as the app executable.
It is recommended that library users set an explicit handler path, depending on the directory/executable structure of their app.
Panics
Panics if path
contains any null bytes.
Examples
let mut options = Options::new(); options.set_handler_path("crashpad_handler");
pub fn set_database_path<P: Into<PathBuf>>(&mut self, path: P)
[src]
Sets the path to the Sentry database directory.
Sentry will use this path to persist user consent, sessions, and other artifacts in case of a crash. This will also be used by the crashpad backend if it is configured.
The path defaults to .sentry-native
in the current working directory,
will be created if it does not exist, and will be resolved to an
absolute path inside of Options::init
.
It is recommended that library users set an explicit absolute path, depending on their apps runtime directory.
Panics
Panics if path
contains any null bytes.
Examples
let mut options = Options::new(); options.set_database_path(".sentry-native");
pub fn set_system_crash_reporter(&mut self, enabled: bool)
[src]
Enables forwarding to the system crash reporter. Disabled by default.
This setting only has an effect when using Crashpad on macOS. If enabled, Crashpad forwards crashes to the macOS system crash reporter. Depending on the crash, this may impact the crash time. Even if enabled, Crashpad may choose not to forward certain crashes.
Examples
let mut options = Options::new(); options.set_system_crash_reporter(true);
pub fn init(self) -> Result<Shutdown, Error>
[src]
Initializes the Sentry SDK with the specified options. Make sure to
capture the resulting Shutdown
, this makes sure to automatically
call shutdown
when it drops.
Errors
Fails with Error::Init
if Sentry couldn't initialize - should only
occur in these situations:
- Fails to create database directory.
- Fails to lock database directory.
Panics
Panics if init
was already called once before.
Examples
let _shutdown = Options::new().init()?;
Trait Implementations
impl Debug for Options
[src]
impl Default for Options
[src]
impl Drop for Options
[src]
impl Eq for Options
[src]
impl PartialEq<Options> for Options
[src]
impl Send for Options
[src]
impl Sync for Options
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
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>,