Module wasmbus_rpc::channel_log
source · [−]Expand description
Simple logging for multi-threaded programs that sends all logs through a crossbeam channel to a logging thread. This works with the existing log macros (debug!, etc.), which can be sent by any thread.
The level can be set with log::set_level() or with RUST_LOG
Structs
A Send
able version of log::Record. The channel logger
converts Record into this before sending. The receiver
logs data from LogRec
Functions
Sets the system logger to log all messages (debug!, info!, etc.) through a crossbeam channel. The caller can pass the receiver to init_receiver() to log to a file, or implement another receiver to perform other processing (such as sending to syslog, or a remote logger). An error return means another logger was already initialized, and rx should be dropped.
Create background thread that uses the provided logger to log all records sent by the sender. If the user wants to change the log format, or log to a different location (file, syslog, or other service), they should not call init_receiver, but instead create their own function to handle LogRec events from the channel.
Type Definitions
Receiving end of the logging channel.