Skip to content

Commit b657c15

Browse files
authored
doc: Add panics section for functions that may panic (#174)
1 parent e065738 commit b657c15

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/integrations/env_logger.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ use crate::integrations::log::{self as sentry_log, LoggerOptions};
3030
/// If a logger is given then it is used, otherwise a new logger is created in the same
3131
/// way as `env_logger::init` does normally. The `global_filter` on the options is set
3232
/// to the filter of the logger.
33+
///
34+
/// # Panics
35+
///
36+
/// This function will panic if it is called more than once, or if another
37+
/// library has already initialized a global logger.
3338
pub fn init(logger: Option<env_logger::Logger>, mut options: LoggerOptions) {
3439
let logger =
3540
logger.unwrap_or_else(|| env_logger::Builder::from_env(env_logger::Env::default()).build());

src/integrations/log.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ fn convert_log_level(level: log::Level) -> Level {
237237
///
238238
/// (For using `env_logger` you can also use the `env_logger` integration
239239
/// which simplifies this).
240+
///
241+
/// # Panics
242+
///
243+
/// This function will panic if it is called more than once, or if another
244+
/// library has already initialized a global logger.
240245
pub fn init(dest: Option<Box<dyn log::Log>>, options: LoggerOptions) {
241246
let logger = Logger::new(dest, options);
242247
let filter = logger.options().effective_global_filter();

0 commit comments

Comments
 (0)