Comments (6)
I don't know because the source code is incomplete.
For example, if m2error()
is calling the default logger, it would report error resource deadlock would occur
because it re-enters HourlyRotatedFileSinkMt
which is not re-entrant, but I can't be sure because your code is incomplete.
from spdlog.
I don't know because the source code is incomplete. For example, if
m2error()
is calling the default logger, it would report errorresource deadlock would occur
because it re-entersHourlyRotatedFileSinkMt
which is not re-entrant, but I can't be sure because your code is incomplete.
Thank you for reply, i updated first post with m2error
from spdlog.
log.hpp is included in stdafx.h and stdafx.h is included in over 100 cpp files
from spdlog.
std::mutex
in HourlyRotatedFileSinkMt
is deadlocked because it is accessing the same HourlyRotatedFileSinkMt
instance through the default logger from at least m2errror()
.
Do not access loggers from sink.
from spdlog.
So then, should i create functions for m2error and m2info ?
Log.h
#pragma once
#include <string>
void m2info(const std::string& message);
void m2error(const std::string& message);
template<typename... Args>
void m2info(const std::string& fmt, Args&&... args);
template<typename... Args>
void m2error(const std::string& fmt, Args&&... args);
log.cpp
#include "log.h"
#include <spdlog/spdlog.h>
void m2info(const std::string& message) {
spdlog::info(message);
}
void m2error(const std::string& message) {
spdlog::error(message);
}
template<typename... Args>
void m2info(const std::string& fmt, Args&&... args) {
spdlog::info(fmt, std::forward(args)...);
}
template<typename... Args>
void m2error(const std::string& fmt, Args&&... args) {
spdlog::error(fmt, std::forward(args)...);
}
Should be enough ?
from spdlog.
The design must be such that loggers are not accessed from inside the sink.
from spdlog.
Related Issues (20)
- [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
- Setting compile time log level seems broken. HOT 10
- Can old files in the Rotating files feature be named by date?
- The description for Event ID 1000 from source XXX cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. HOT 2
- Is spdlog can support placeholders %0 %1 like {0} {1} HOT 2
- fmt conflict with another lib (VRS) HOT 1
- getting exception: spdlog::spdlog_ex HOT 11
- converting UCN to execution character set: Invalid or incomplete multibyte or wide character HOT 1
- spdlog example project doesn't work when built with Visual Studio 2022 and run on Windows 7 HOT 5
- Q: Start newline every time we are starting the log HOT 1
- libspdlogd.so.1.14 => not found, can't find the way to link spdlog with an rpath HOT 2
- Branch coverage issue for SPDLOG in gcov HOT 4
- did spdlog work on Windows Server ? HOT 3
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.