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-13 16:17:09 +02:00
|
|
|
#include <cstdio>
|
|
|
|
|
|
2020-03-06 15:21:21 +02:00
|
|
|
void load_levels_example();
|
2019-12-13 16:17:09 +02:00
|
|
|
void stdout_logger_example();
|
|
|
|
|
void basic_example();
|
|
|
|
|
void rotating_example();
|
|
|
|
|
void daily_example();
|
|
|
|
|
void async_example();
|
|
|
|
|
void binary_example();
|
2020-08-29 02:48:43 +03:00
|
|
|
void stopwatch_example();
|
2019-12-13 16:17:09 +02:00
|
|
|
void trace_example();
|
|
|
|
|
void multi_sink_example();
|
|
|
|
|
void user_defined_example();
|
|
|
|
|
void err_handler_example();
|
|
|
|
|
void syslog_example();
|
2020-03-21 13:33:04 +02:00
|
|
|
void custom_flags_example();
|
2019-12-13 16:17:09 +02:00
|
|
|
|
2019-12-22 20:40:19 +02:00
|
|
|
#include "spdlog/spdlog.h"
|
2020-03-15 18:56:38 +02:00
|
|
|
#include "spdlog/cfg/env.h" // for loading levels from the environment variable
|
2020-09-26 15:06:53 +03:00
|
|
|
#include "spdlog/sinks/stdout_color_sinks.h"
|
2019-08-22 19:58:49 +03:00
|
|
|
|
2020-02-26 19:21:36 +02:00
|
|
|
int main(int, char *[])
|
2019-12-08 17:08:20 +02:00
|
|
|
{
|
2020-03-06 15:21:21 +02:00
|
|
|
// Log levels can be loaded from argv/env using "SPDLOG_LEVEL"
|
|
|
|
|
spdlog::cfg::load_env_levels();
|
2020-09-26 15:06:53 +03:00
|
|
|
spdlog::info("Default logger");
|
|
|
|
|
auto l1 = spdlog::stdout_color_mt("l1");
|
|
|
|
|
auto l2 = spdlog::stdout_color_mt("l2");
|
2020-03-21 15:25:26 +02:00
|
|
|
|
2020-09-26 15:06:53 +03:00
|
|
|
l1->debug("L1");
|
|
|
|
|
l2->trace("L2");
|
|
|
|
|
}
|