Skip to content

Logging

monero-cpp and the wallet of monero log what they do, and nothing is written until the logging is configured. The log is the first place to look when a wallet does not do what it should:

from monero import MoneroUtils

MoneroUtils.configure_logging("monero.log", False)      # to a file, and not to the console
MoneroUtils.set_log_level(1)                            # 0 is the least, 4 the most
MoneroUtils.set_log_categories("*:WARNING,wallet.wallet2:INFO")

The categories are the ones of monero: a list of category:level, where * is every category. The log_* functions write to the same log, for the messages of the application next to the ones of the wallet.

configure_logging(path, console) staticmethod

Initialize logging.

Parameters:

Name Type Description Default
path str

the path to write logs to.

required
console bool

specifies whether or not to write to the console.

required

set_log_level(loglevel) staticmethod

Set the library's log level with 0 being least verbose.

Parameters:

Name Type Description Default
loglevel int

the library's log level.

required

set_log_categories(categories) staticmethod

Set the library's log categories.

Parameters:

Name Type Description Default
categories str

the library's log categories to set.

required

log_trace(message) staticmethod

Log trace message.

Parameters:

Name Type Description Default
message str

the message to log.

required

log_debug(message) staticmethod

Log debug message.

Parameters:

Name Type Description Default
message str

the message to log.

required

log_info(message) staticmethod

Log info message.

Parameters:

Name Type Description Default
message str

the message to log.

required

log_warning(message) staticmethod

Log warning message.

Parameters:

Name Type Description Default
message str

the message to log.

required

log_error(message) staticmethod

Log error message.

Parameters:

Name Type Description Default
message str

the message to log.

required