Comments (9)
Logging macros such as SPDLOG_LOGGER_DEBUG
are used to remove logging statements that are not needed in the product: https://github.com/gabime/spdlog/wiki/0.-FAQ#how-to-remove-all-debug-statements-at-compile-time-
If you want to enable log output according to the log level required by the user, use the log level filter API such as spdlog::set_level()
to set the log level to be logged at runtime.
from spdlog.
Logging macros such as
SPDLOG_LOGGER_DEBUG
are used to remove logging statements that are not needed in the product: https://github.com/gabime/spdlog/wiki/0.-FAQ#how-to-remove-all-debug-statements-at-compile-time-
Yes. I am aware of that.
If you want to enable log output according to the log level required by the user, use the log level filter API such asspdlog::set_level()
to set the log level to be logged at runtime.
That will make all paramterws in the log calls I use evaluated even if the log level is disabled. That is why I am trying to either disable it totally (best solution) or lazy-evaluate log parameters in some way because an empty call will be done. This is server-side software so I would like to remove every piece of overhead as much as possible.
from spdlog.
I would like to remove every piece of overhead as much as possible.
Does overhead mean matchToken.toString()
?
If so, a user-defined type formatter in the fmt library (https://fmt.dev/10.2.0/api.html#formatting-user-defined-types) can lazy the evaluation of matchToken.toString()
after filtering by log level.
from spdlog.
These macros do exactly what you need. Not sure why get multiple definitions error.
from spdlog.
These macros do exactly what you need. Not sure why get multiple definitions error.
Please see above. I define the active level and I get multiple definitions. I use the pre-compiled (not the header-only) library, so probably it is the source of the problem?
from spdlog.
I get multiple definitions
Shouldn't happen. Something is wrong with your build. For example see this define in the tests.
from spdlog.
If the precompiled headers are generated by CMake, it may be due to CMake's ability to record the arguments of the cmake
command.
For example, if cmake -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE
is defined when building a precompiled header, -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE
is recorded and -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE
is automatically added to the argument when the precompiled header is used.
from spdlog.
My setup is consuming a library (Not header-only, but precompiled outside of the project). I consume it via pkg config and in ky build system for my libs I link spdlog precompiled and try to change the active log level macro.
Probably that is where the mismatch kight come from: precompiled lib has the active log level as something and my lib when using it redefines it?
from spdlog.
Since the macro redefinition warning message is printed, we should assume that build tools is defining the macro.
Have you checked to see if your build tool has the ability to automatically define macros?
from spdlog.
Related Issues (20)
- spdlog 1.14.1 fails to build with fmt 11.0.1 HOT 2
- Log rotation does not work if the log file has multiple owner processes
- i can't build it about Spalog, need help~ HOT 1
- compiler error on vs2015 HOT 5
- why the symbol of stopwatch not in libspdlog.dylib HOT 1
- ANSI color sink on Windows
- Resource deadlock would ocur HOT 6
- Undefined symbol error for spdlog::details::os::utf8_to_strbuf on Windows HOT 1
- build with SPDLOG_FMT_EXTERNAL_HO error HOT 2
- Windows linker warnings disabled HOT 1
- How do I log a std::iostream? HOT 2
- [MSVC 17.10.5] spdlog::sinks::base_sink<Mutex>::set_pattern() crash HOT 5
- For non-SPDLOG_HEADER_ONLY builds enable export attributes for symbols HOT 9
- Enums do not work. HOT 1
- Why customized logger can't print function name? HOT 3
- When initializing, it prompts "simple log instance" HOT 1
- spdlog does not print in python async function HOT 1
- error: call to non-‘constexpr’ function ‘long int sysconf(int)’ HOT 1
- I found that we can use python format style: HOT 2
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.