example update

This commit is contained in:
gabime 2016-06-22 00:36:34 +03:00
parent db01c6b64d
commit 70d0e87328
2 changed files with 10 additions and 10 deletions

View File

@ -92,15 +92,15 @@ int main(int, char* [])
// //
// Create a basic multithreaded file logger (use "file_logger_st" for the single threaded version) // Create a basic multithreaded file logger (use "file_logger_st" for the single threaded version)
// //
auto simple_logger = spd::file_logger_mt("basic_logger", "logs/simple.txt"); auto my_logger = spd::file_logger_mt("basic_logger", "logs/basic.txt");
simple_logger->info("Some log message"); my_logger->info("Some log message");
// //
// 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 rotating_logger = spd::rotating_logger_mt("some_logger_name", "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); rotating_logger->info("{} * {} equals {:>10}", i, i, i*i);
// //
// Create a daily logger - a new file is created every day on 2:30am // Create a daily logger - a new file is created every day on 2:30am
@ -111,7 +111,7 @@ int main(int, char* [])
// 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 ***");
file_logger->info("This is another message with custom format"); rotating_logger->info("This is another message with custom format");
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");

View File

@ -44,21 +44,21 @@ int main(int, char*[])
console->debug("This message shold be displayed.."); console->debug("This message shold be displayed..");
// Create basic file logger (not rotated) // Create basic file logger (not rotated)
auto simple_logger = spd::basic_logger_mt("basic_logger", "logs/simple.txt"); auto my_logger = spd::basic_logger_mt("basic_logger", "logs/basic.txt");
simple_logger->info("Some log message"); my_logger->info("Some log message");
// 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 rotating_logger = spd::rotating_logger_mt("some_logger_name", "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); rotating_logger->info("{} * {} equals {:>10}", i, i, i*i);
// Create a daily logger - a new file is created every day on 2:30am // Create a daily logger - a new file is created every day on 2:30am
auto daily_logger = spd::daily_logger_mt("daily_logger", "logs/daily", 2, 30); auto daily_logger = spd::daily_logger_mt("daily_logger", "logs/daily", 2, 30);
// 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 ***");
file_logger->info("This is another message with custom format"); rotating_logger->info("This is another message with custom format");
// Compile time debug or trace macros. // Compile time debug or trace macros.