Update README.md

This commit is contained in:
Gabi Melman 2020-04-26 09:23:31 +03:00 committed by GitHub
parent a4665c27df
commit 9b84337830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,20 +86,7 @@ int main()
}
```
#### Load log levels from env variable or from argv
```c++
#include "spdlog/cfg/env.h"
void load_levels_example()
{
// Set the log level to "info" and mylogger to to "trace":
// SPDLOG_LEVEL=info,mylogger=trace && ./example
spdlog::cfg::load_env_levels();
// or from command line:
// ./example SPDLOG_LEVEL=info,mylogger=trace
// #include "spdlog/cfg/argv.h" // for loading levels from argv
// spdlog::cfg::load_argv_levels(args, argv);
}
```
---
#### Create stdout/stderr logger object
```c++
#include "spdlog/spdlog.h"
@ -112,6 +99,7 @@ void stdout_example()
spdlog::get("console")->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name)");
}
```
---
#### Basic file logger
```c++
@ -326,7 +314,6 @@ void err_handler_example()
```
---
#### syslog
```c++
@ -350,6 +337,22 @@ void android_example()
}
```
---
#### Load log levels from env variable or from argv
```c++
#include "spdlog/cfg/env.h"
void load_levels_example()
{
// Set the log level to "info" and mylogger to to "trace":
// SPDLOG_LEVEL=info,mylogger=trace && ./example
spdlog::cfg::load_env_levels();
// or from command line:
// ./example SPDLOG_LEVEL=info,mylogger=trace
// #include "spdlog/cfg/argv.h" // for loading levels from argv
// spdlog::cfg::load_argv_levels(args, argv);
}
```
## Benchmarks
Below are some [benchmarks](https://github.com/gabime/spdlog/blob/v1.x/bench/bench.cpp) done in Ubuntu 64 bit, Intel i7-4770 CPU @ 3.40GHz