mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 18:41:35 +08:00
wip
This commit is contained in:
parent
a87700a28c
commit
1a1c37db7c
@ -23,10 +23,10 @@ void syslog_example();
|
|||||||
#include <spdlog/loaders/env.h>
|
#include <spdlog/loaders/env.h>
|
||||||
#include <spdlog/loaders/argv.h>
|
#include <spdlog/loaders/argv.h>
|
||||||
|
|
||||||
int main(int args, const char *argv[])
|
int main(int args, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
spdlog::loaders::load_env();
|
//spdlog::loaders::load_env();
|
||||||
spdlog::loaders::load_argv(args, argv);
|
spdlog::loaders::load_argv(args, argv);
|
||||||
spdlog::info("HELLO INFO");
|
spdlog::info("HELLO INFO");
|
||||||
|
|
||||||
|
@ -36,9 +36,5 @@ void load_argv(int args, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_argv(int args, const char **argv)
|
|
||||||
{
|
|
||||||
return load_argv(args, const_cast<const char**>(argv));
|
|
||||||
}
|
|
||||||
} // namespace loaders
|
} // namespace loaders
|
||||||
} // namespace spdlog
|
} // namespace spdlog
|
||||||
|
@ -20,7 +20,7 @@ TEST_CASE("env", "[loaders]")
|
|||||||
TEST_CASE("argv1", "[loaders]")
|
TEST_CASE("argv1", "[loaders]")
|
||||||
{
|
{
|
||||||
const char *argv[] = {"ignore", "SPDLOG_LEVEL=l1=warn"};
|
const char *argv[] = {"ignore", "SPDLOG_LEVEL=l1=warn"};
|
||||||
load_argv(2, argv);
|
load_argv(2, const_cast<char**>(argv));
|
||||||
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
||||||
REQUIRE(l1->level() == spdlog::level::warn);
|
REQUIRE(l1->level() == spdlog::level::warn);
|
||||||
REQUIRE(spdlog::default_logger()->level() == spdlog::level::info);
|
REQUIRE(spdlog::default_logger()->level() == spdlog::level::info);
|
||||||
@ -30,7 +30,7 @@ TEST_CASE("argv1", "[loaders]")
|
|||||||
TEST_CASE("argv2", "[loaders]")
|
TEST_CASE("argv2", "[loaders]")
|
||||||
{
|
{
|
||||||
const char *argv[] = {"ignore", "SPDLOG_LEVEL=l1=warn,trace"};
|
const char *argv[] = {"ignore", "SPDLOG_LEVEL=l1=warn,trace"};
|
||||||
load_argv(2, argv);
|
load_argv(2, const_cast<char**>(argv));
|
||||||
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
||||||
REQUIRE(l1->level() == spdlog::level::warn);
|
REQUIRE(l1->level() == spdlog::level::warn);
|
||||||
REQUIRE(spdlog::default_logger()->level() == spdlog::level::trace);
|
REQUIRE(spdlog::default_logger()->level() == spdlog::level::trace);
|
||||||
@ -40,7 +40,7 @@ TEST_CASE("argv2", "[loaders]")
|
|||||||
TEST_CASE("argv3", "[loaders]")
|
TEST_CASE("argv3", "[loaders]")
|
||||||
{
|
{
|
||||||
const char *argv[] = {"ignore", "SPDLOG_LEVEL="};
|
const char *argv[] = {"ignore", "SPDLOG_LEVEL="};
|
||||||
load_argv(2, argv);
|
load_argv(2, const_cast<char**>(argv));
|
||||||
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
||||||
REQUIRE(l1->level() == spdlog::level::info);
|
REQUIRE(l1->level() == spdlog::level::info);
|
||||||
REQUIRE(spdlog::default_logger()->level() == spdlog::level::info);
|
REQUIRE(spdlog::default_logger()->level() == spdlog::level::info);
|
||||||
@ -50,7 +50,7 @@ TEST_CASE("argv3", "[loaders]")
|
|||||||
TEST_CASE("argv4", "[loaders]")
|
TEST_CASE("argv4", "[loaders]")
|
||||||
{
|
{
|
||||||
const char *argv[] = {"ignore", "SPDLOG_LEVEL=junk"};
|
const char *argv[] = {"ignore", "SPDLOG_LEVEL=junk"};
|
||||||
load_argv(2, argv);
|
load_argv(2, const_cast<char**>(argv));
|
||||||
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
auto l1 = spdlog::create<spdlog::sinks::test_sink_st>("l1");
|
||||||
REQUIRE(l1->level() == spdlog::level::info);
|
REQUIRE(l1->level() == spdlog::level::info);
|
||||||
spdlog::drop(l1->name());
|
spdlog::drop(l1->name());
|
||||||
|
Loading…
Reference in New Issue
Block a user