1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-01-16 01:37:58 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Gabi Melman
d977dd4395
Update README.md 2020-04-26 09:40:56 +03:00
Gabi Melman
ca402379a9
Update README.md 2020-04-26 09:35:52 +03:00
Gabi Melman
903bf2135d
Update README.md 2020-04-26 09:34:03 +03:00
Gabi Melman
1f732585b2
Update README.md 2020-04-26 09:26:52 +03:00
Gabi Melman
224de0601e
Update README.md 2020-04-26 09:24:33 +03:00
Gabi Melman
9b84337830
Update README.md 2020-04-26 09:23:31 +03:00
Gabi Melman
a4665c27df
Update README.md 2020-04-26 09:20:14 +03:00
Gabi Melman
3337015346
Update README.md 2020-04-26 09:19:05 +03:00

View File

@ -35,9 +35,8 @@ $ cmake .. && make -j
## Features
* Very fast (see [benchmarks](#benchmarks) below).
* Headers only or compiled version
* Headers only or compiled
* Feature rich formatting, using the excellent [fmt](https://github.com/fmtlib/fmt) library.
* **New!** [Backtrace](#backtrace-support) support - store debug messages in a ring buffer and display later on demand.
* Asynchronous mode (optional)
* [Custom](https://github.com/gabime/spdlog/wiki/3.-Custom-formatting) formatting.
* Multi/Single threaded loggers.
@ -50,7 +49,7 @@ $ cmake .. && make -j
* Easily extendable with custom log targets (just implement a single function in the [sink](include/spdlog/sinks/sink.h) interface).
* Log filtering - log levels can be modified in runtime as well as in compile time.
* Support for loading log levels from argv or from environment var.
* [Backtrace](#backtrace-support) support - store debug messages in a ring buffer and display later on demand.
## Usage samples
@ -87,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"
@ -113,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++
@ -327,7 +314,6 @@ void err_handler_example()
```
---
#### syslog
```c++
@ -351,6 +337,28 @@ void android_example()
}
```
---
#### Load log levels from env variable or from argv
```c++
#include "spdlog/cfg/env.h"
int main (int argc, char *argv[])
{
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);
}
```
So then you can:
```console
$ export SPDLOG_LEVEL=info,mylogger=trace
$ ./example
```
---
## 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