2019-03-24 00:40:27 +02:00
|
|
|
//
|
|
|
|
|
// Copyright(c) 2015 Gabi Melman.
|
|
|
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
2019-05-12 17:05:14 +03:00
|
|
|
|
2019-03-24 00:40:27 +02:00
|
|
|
// spdlog usage example
|
|
|
|
|
|
2019-12-08 13:35:15 +02:00
|
|
|
#include <spdlog/spdlog.h>
|
|
|
|
|
#include <spdlog/cfg/env.h>
|
2019-12-13 14:49:41 +02:00
|
|
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
2019-08-22 19:58:49 +03:00
|
|
|
|
2019-12-08 17:08:20 +02:00
|
|
|
int main(int, char *[])
|
|
|
|
|
{
|
|
|
|
|
try
|
2019-09-05 18:32:54 +03:00
|
|
|
{
|
2019-12-13 15:14:20 +02:00
|
|
|
spdlog::set_level(spdlog::level::warn);
|
2019-12-13 14:49:41 +02:00
|
|
|
spdlog::env::load_levels();
|
2019-12-13 15:14:20 +02:00
|
|
|
|
2019-12-13 14:49:41 +02:00
|
|
|
auto l1 = spdlog::stderr_color_st("l1");
|
|
|
|
|
auto l2 = spdlog::stderr_color_st("l2");
|
2019-12-13 15:14:20 +02:00
|
|
|
|
2019-12-13 14:49:41 +02:00
|
|
|
spdlog::info("Hello default logger");
|
|
|
|
|
l1->debug("Hello l1");
|
2019-12-13 15:14:20 +02:00
|
|
|
// l2->trace("Hello l2");
|
2019-12-08 17:07:52 +02:00
|
|
|
}
|
2019-12-08 17:08:20 +02:00
|
|
|
catch (spdlog::spdlog_ex &ex)
|
|
|
|
|
{
|
2019-12-08 17:07:52 +02:00
|
|
|
spdlog::info("spdlog_ex: {}", ex.what());
|
2019-09-05 18:32:54 +03:00
|
|
|
}
|
|
|
|
|
}
|