X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Flogger.rs;h=cec6bb5c2035480a69f7994dd2bbab496e1e5e86;hp=dc67386841c02ff3ba070e18694ed92dddadb497;hb=a82e075188fc15a103234832686915c196bfe240;hpb=2c56d2b4709d39d5e96ec84e4ecb07f9ebed0387 diff --git a/lightning-c-bindings/src/lightning/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index dc67386..cec6bb5 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -82,6 +82,26 @@ impl Level { pub extern "C" fn Level_clone(orig: &Level) -> Level { orig.clone() } +#[no_mangle] +/// Utility method to constructs a new Trace-variant Level +pub extern "C" fn Level_trace() -> Level { + Level::Trace} +#[no_mangle] +/// Utility method to constructs a new Debug-variant Level +pub extern "C" fn Level_debug() -> Level { + Level::Debug} +#[no_mangle] +/// Utility method to constructs a new Info-variant Level +pub extern "C" fn Level_info() -> Level { + Level::Info} +#[no_mangle] +/// Utility method to constructs a new Warn-variant Level +pub extern "C" fn Level_warn() -> Level { + Level::Warn} +#[no_mangle] +/// Utility method to constructs a new Error-variant Level +pub extern "C" fn Level_error() -> Level { + Level::Error} /// Checks if two Levels contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] @@ -119,6 +139,14 @@ pub struct Logger { } unsafe impl Send for Logger {} unsafe impl Sync for Logger {} +#[no_mangle] +pub(crate) extern "C" fn Logger_clone_fields(orig: &Logger) -> Logger { + Logger { + this_arg: orig.this_arg, + log: Clone::clone(&orig.log), + free: Clone::clone(&orig.free), + } +} use lightning::util::logger::Logger as rustLogger; impl rustLogger for Logger {