Comments (5)
For now, the only documentation on custom formatters is the Wiki (the Wiki can be edited by anyone).
If the Wiki documentation lacks information, you are left to figure out how to create a custom formatter from an existing formatter implementation.
See: https://github.com/gabime/spdlog/blob/v1.12.0/include/spdlog/pattern_formatter-inl.h
from spdlog.
You can use set_color
API.
spdlog/include/spdlog/sinks/ansicolor_sink-inl.h
Lines 33 to 38 in ac55e60
spdlog/include/spdlog/sinks/wincolor_sink-inl.h
Lines 42 to 48 in ac55e60
from spdlog.
Thank you for the reply.
Changing color is not enough for what I want to achieve.
Basically I want the following pattern if the level is below or equal to INFO (the color is only used for the level text):
But for other, more critical levels I want:
Thus it makes two distinct patterns, with a list of applicable levels for each one.
from spdlog.
The color range format flag (start: %^
, end %$
) can be used to adjust the color range of the message, but the ability to set it per log level is not supported.
You may want to consider the custom formatter.
from spdlog.
Yep I know how to create the pattern. My point was about how to affect pattern to level.
Any doc please about 'custom formatter' I don't manage to find it.
Thanks
from spdlog.
Related Issues (20)
- spdlog not adaptable with newer versions of fmt HOT 6
- Some short guidance for adding sinks on the fly HOT 7
- Can not find basic_runtime under namespace fmt HOT 1
- [Possible Bug] : undesired deletion of logger from registry(loggers_ map) HOT 2
- catch program exception HOT 6
- Crash when using async_logger with threadpool HOT 6
- spdlog 1.x版本中msvc fmt HOT 9
- Output to debugView msvc_sink does not show prints HOT 4
- CMake CMP0077 issue after removing policy_max. HOT 1
- fatal error: spdlog/cfg/env.h: No such file or directory HOT 7
- undefined reference to `fmt::v9::detail::assert_fail(char const*, int, char const*)' when build using version 1.12.0
- payload in callback_sink getting trailing garbage HOT 3
- latency HOT 5
- clang-tidy reports about uninitialized members HOT 2
- wstr_to_utf8buf throw exception HOT 1
- Sdplog thread in synchronous mode HOT 4
- In class backtracer do we rellay need variable enabled_ be atomic? HOT 3
- spdlog build on android,cmake config failed with fmt not founded. HOT 11
- Cannot build on Windows with Visual Studio HOT 1
- Can't log to file asynchronously HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdlog.