Skip to content

Logging

Seulgi Kim edited this page Jun 25, 2018 · 8 revisions

Logging

$ RUST_LOG="debug" codechain

$ RUST_LOG="tx=trace, parcel=info" codechain

Log Level

CodeChain has five log level, error, warn, info, debug and trace.

The error level represents the event something can be dangerous, but it can still run. In the case that cannot run anymore, it must crash ASAP instead of logging.

The warn level represents the event that is potentially dangerous.

The info level represents the event that is not dangerous, but it's useful to know for users.

The debug level represents the event that is useful for developers not for users.

codechain-logger

macros

CodeChain has the macro for designated log targets, cerror, cwarn, cinfo, cdebug and ctrace. These macros are designed for the designated targets.

How to Add a New Target

The available targets are described in log_target. You must add new mapping to add a new target.

(TARGET_NAME_IN_CODE) => {
    "target_name_in_logger"
};
Clone this wiki locally