Skip to content

Commit

Permalink
Expose control over log level
Browse files Browse the repository at this point in the history
  • Loading branch information
dholroyd committed May 14, 2022
1 parent 5e6adce commit 752632d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,32 @@ pub fn startup() -> Result<()> {
}
}

pub mod log {
pub enum Level {
Crit,
Err,
Warning,
Notice,
Info,
Debug,
}
impl Level {
fn as_cint(&self) -> std::os::raw::c_int {
match self {
Level::Crit => 2,
Level::Err => 3,
Level::Warning => 4,
Level::Notice => 5,
Level::Info => 6,
Level::Debug => 7,
}
}
}
pub fn set_level(level: Level) {
unsafe { super::srt::srt_setloglevel(level.as_cint()) };
}
}

pub fn cleanup() -> Result<()> {
let result = unsafe { srt::srt_cleanup() };
error::handle_result((), result)
Expand Down

0 comments on commit 752632d

Please sign in to comment.