Logger class for ostream or syslog.
Java style api for logging.
logger.
info(
"Triggering compaction");
Logger class for ostream or syslog.
Definition: log.hh:90
void info(format_info fmt, Args &&... args) noexcept
Definition: log.hh:355
The output format is: (depending on level) DEBUG Y-m-d T,%03d [shard 0] - "your msg"
It is possible to rate-limit log messages, see logger::rate_limit.
#include <seastar/util/log.hh>
|
template<typename... Args> |
void | error (format_info fmt, Args &&... args) noexcept |
|
template<typename... Args> |
void | warn (format_info fmt, Args &&... args) noexcept |
|
template<typename... Args> |
void | info (format_info fmt, Args &&... args) noexcept |
|
template<typename... Args> |
void | info0 (format_info fmt, Args &&... args) noexcept |
|
template<typename... Args> |
void | debug (format_info fmt, Args &&... args) noexcept |
|
template<typename... Args> |
void | trace (format_info fmt, Args &&... args) noexcept |
|
const sstring & | name () const noexcept |
|
log_level | level () const noexcept |
|
void | set_level (log_level level) noexcept |
|
◆ debug()
template<typename... Args>
void seastar::logger::debug |
( |
format_info |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Log with debug tag: DEBUG Y-m-d T,%03d [shard 0] - "your msg"
- Parameters
-
fmt | - {fmt} style format string (implictly converted to struct logger::format_info) or a logger::format_info passed down the call chain. |
args | - args to print string |
◆ error()
template<typename... Args>
void seastar::logger::error |
( |
format_info |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Log with error tag: ERROR Y-m-d T,%03d [shard 0] - "your msg"
- Parameters
-
fmt | - {fmt} style format string (implictly converted to struct logger::format_info) or a logger::format_info passed down the call chain. |
args | - args to print string |
◆ info()
template<typename... Args>
void seastar::logger::info |
( |
format_info |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Log with info tag: INFO Y-m-d T,%03d [shard 0] - "your msg"
- Parameters
-
fmt | - {fmt} style format string (implictly converted to struct logger::format_info) or a logger::format_info passed down the call chain. |
args | - args to print string |
◆ info0()
template<typename... Args>
void seastar::logger::info0 |
( |
format_info |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Log with info tag on shard zero only: INFO Y-m-d T,%03d [shard 0] - "your msg"
- Parameters
-
fmt | - {fmt} style format string (implictly converted to struct logger::format_info) or a logger::format_info passed down the call chain. |
args | - args to print string |
◆ level()
- Returns
- current log level for this logger
◆ name()
const sstring& seastar::logger::name |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- name of the logger. Usually one logger per module
◆ set_level()
void seastar::logger::set_level |
( |
log_level |
level | ) |
|
|
inlinenoexcept |
◆ set_shard_field_width()
static void seastar::logger::set_shard_field_width |
( |
unsigned |
width | ) |
|
|
staticnoexcept |
Set the width of shard id field in log messages
this_shard_id()
is printed as a part of the prefix in logging messages, like "[shard 42]", where 42
is the decimal number of the current shard id printed with a minimal width.
- Parameters
-
width | the minimal width of the shard id field |
◆ set_syslog_enabled()
static void seastar::logger::set_syslog_enabled |
( |
bool |
enabled | ) |
|
|
staticnoexcept |
Also output to syslog. default is false
NOTE: syslog() can block, which will stall the reactor thread. this should be rare (will have to fill the pipe buffer before syslogd can clear it) but can happen.
◆ set_with_color()
static void seastar::logger::set_with_color |
( |
bool |
enabled | ) |
|
|
staticnoexcept |
enable/disable the colored tag in ostream
- Note
- this is a noop if fmtlib's version is less than 6.0
◆ trace()
template<typename... Args>
void seastar::logger::trace |
( |
format_info |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Log with trace tag: TRACE Y-m-d T,%03d [shard 0] - "your msg"
- Parameters
-
fmt | - {fmt} style format string (implictly converted to struct logger::format_info) or a logger::format_info passed down the call chain. |
args | - args to print string |
◆ warn()
template<typename... Args>
void seastar::logger::warn |
( |
format_info |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Log with warning tag: WARN Y-m-d T,%03d [shard 0] - "your msg"
- Parameters
-
fmt | - {fmt} style format string (implictly converted to struct logger::format_info) or a logger::format_info passed down the call chain. |
args | - args to print string |
The documentation for this class was generated from the following file: