mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-12 17:00:25 +08:00
Update README.md
This commit is contained in:
parent
0221466daa
commit
9d7c105250
16
README.md
16
README.md
@ -82,8 +82,8 @@ int main(int, char* [])
|
|||||||
console->info("{:<30}", "left aligned");
|
console->info("{:<30}", "left aligned");
|
||||||
console->info("{:>30}", "right aligned");
|
console->info("{:>30}", "right aligned");
|
||||||
console->info("{:^30}", "centered");
|
console->info("{:^30}", "centered");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Runtime log levels
|
// Runtime log levels
|
||||||
//
|
//
|
||||||
spd::set_level(spd::level::info); //Set global log level to info
|
spd::set_level(spd::level::info); //Set global log level to info
|
||||||
@ -91,14 +91,14 @@ int main(int, char* [])
|
|||||||
console->set_level(spd::level::info); // Set specific logger's log level
|
console->set_level(spd::level::info); // Set specific logger's log level
|
||||||
console->info("Now it should..");
|
console->info("Now it should..");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create a file rotating logger with 5mb size max and 3 rotated files
|
// Create a file rotating logger with 5mb size max and 3 rotated files
|
||||||
//
|
//
|
||||||
auto file_logger = spd::rotating_logger_mt("file_logger", "logs/mylogfile", 1048576 * 5, 3);
|
auto file_logger = spd::rotating_logger_mt("file_logger", "logs/mylogfile", 1048576 * 5, 3);
|
||||||
for(int i = 0; i < 10; ++i)
|
for(int i = 0; i < 10; ++i)
|
||||||
file_logger->info("{} * {} equals {:>10}", i, i, i*i);
|
file_logger->info("{} * {} equals {:>10}", i, i, i*i);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Customize msg format for all messages
|
// Customize msg format for all messages
|
||||||
//
|
//
|
||||||
spd::set_pattern("*** [%H:%M:%S %z] [thread %t] %v ***");
|
spd::set_pattern("*** [%H:%M:%S %z] [thread %t] %v ***");
|
||||||
@ -106,10 +106,10 @@ int main(int, char* [])
|
|||||||
|
|
||||||
spd::get("console")->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name) function");
|
spd::get("console")->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name) function");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compile time debug or trace macros.
|
// Compile time debug or trace macros.
|
||||||
// Enabled #ifdef SPDLOG_DEBUG_ON or #ifdef SPDLOG_TRACE_ON
|
// Enabled #ifdef SPDLOG_DEBUG_ON or #ifdef SPDLOG_TRACE_ON
|
||||||
//
|
//
|
||||||
SPDLOG_TRACE(console, "Enabled only #ifdef SPDLOG_TRACE_ON..{} ,{}", 1, 3.23);
|
SPDLOG_TRACE(console, "Enabled only #ifdef SPDLOG_TRACE_ON..{} ,{}", 1, 3.23);
|
||||||
SPDLOG_DEBUG(console, "Enabled only #ifdef SPDLOG_DEBUG_ON.. {} ,{}", 1, 3.23);
|
SPDLOG_DEBUG(console, "Enabled only #ifdef SPDLOG_DEBUG_ON.. {} ,{}", 1, 3.23);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user