Add README note on switch logging to stderr

pull/1775/head
Tony Lewis 5 years ago
parent aa2053a575
commit 9225e5fa92

@ -81,7 +81,30 @@ int main()
} }
``` ```
---
#### Switch logging output to stderr
```c++
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"
int main()
{
// Replace the default logger with a (color, single-threaded) stderr
// logger with name "" (but first replace it with an arbitrarily-named
// logger to prevent a name clash)
spdlog::set_default_logger( spdlog::stderr_color_st( "some_arbitrary_name" ) );
spdlog::set_default_logger( spdlog::stderr_color_st( "" ) );
spdlog::info("This message will go to stderr");
}
```
--- ---
#### Create stdout/stderr logger object #### Create stdout/stderr logger object
```c++ ```c++
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"

Loading…
Cancel
Save