Central logger that formats entries and writes them to the console, a file and callbacks.

Synopsis

Declared in <logging.h>

class Logger;

Member Functions

Name

Description

AddCategoryLogLevel

Set the override log level for a single category.

CategoryLevels

Get the per‐category log levels.

DefaultShrinkDebugFile

Whether the debug log file should be shrunk on startup by default.

DeleteCallback

Delete a connection

DisableCategory

DisableCategory overloads

DisableLogging

Disable logging This offers a slight speedup and slightly smaller memory usage compared to leaving the logging system in its default state. Mostly intended for libbitcoin‐kernel apps that don't want any logging. Should be used instead of StartLogging().

DisconnectTestLogger

Only for testing

EnableCategory

EnableCategory overloads

Enabled

Returns whether logs will be written to any output

GetCategoryMask

Get the bitmask of enabled log categories.

LogCategoriesList

Returns a vector of the log categories in alphabetical order.

LogCategoriesString

Returns a string with the log categories in alphabetical order.

LogLevel

Get the current global log level.

LogLevelsString

Returns a string with all user‐selectable log levels.

LogPrint

Send an entry to the log output

NumConnections

Count the callbacks currently connected to the print signal.

PushBackCallback

Connect a slot to the print signal and return the connection

SetCategoryLogLevel

SetCategoryLogLevel overloads

SetLogLevel

SetLogLevel overloads

SetRateLimiting

Install the rate limiter used to throttle noisy log locations.

ShrinkDebugFile

Shrink the debug log file to a reasonable size on startup.

StartLogging

Start logging (and flush all buffered messages)

WillLogCategory

Check whether a category is enabled at all.

WillLogCategoryLevel

Check whether a category would be logged at a given level.

Static Member Functions

Name

Description

GetLogCategory

Return log flag if str parses as a log category.

LogLevelToStr

Returns the string representation of a log level.

Data Members

Name

Description

m_always_print_category_level

Whether to always print the category and level.

m_file_path

Path of the debug log file.

m_log_sourcelocations

Whether to include the source location.

m_log_threadnames

Whether to include the originating thread name.

m_log_time_micros

Whether timestamps include microsecond precision.

m_log_timestamps

Whether to prefix entries with a timestamp.

m_print_to_console

Whether log entries are written to the console.

m_print_to_file

Whether log entries are written to the debug log file.

m_reopen_file

Request to reopen the log file, e.g. after log rotation.

Non-Member Functions

Name

Description

::LogInstance

Access the global logger instance.

Created with MrDocs