This commit is contained in:
gabime
2014-10-31 16:34:48 +02:00
parent 31971bf63b
commit 2d075bcfda
9 changed files with 98 additions and 118 deletions

View File

@@ -10,11 +10,12 @@ int main(int, char* [])
{
namespace spd = spdlog;
try
{
std::string filename = "spdlog_example";
auto console = spd::stderr_logger_mt("console");
console->info("Welcome to spdlog!");
console->info("Welcome to spdlog!") ;
console->info() << "Creating file " << filename << "..";
auto file_logger = spd::rotating_logger_mt("file_logger", filename, 1024 * 1024 * 5, 3);
@@ -26,7 +27,6 @@ int main(int, char* [])
file_logger->info() << i << '*' << i << '=' << square << " (" << "0x" << std::hex << square << ")";
}
// Change log level to all loggers to warning and above
spd::set_level(spd::level::WARN);
console->info("This should not be displayed");
@@ -40,6 +40,5 @@ int main(int, char* [])
{
std::cout << "Log failed: " << ex.what() << std::endl;
}
}