Comments (5)
I see. Let me think how to better implement it.
from plog.
May I ask whether this issue is on your roadmap somewhere?
from plog.
Oh, it's good you pinged me back.
plog::init
is designed for one time initialization and live for the whole app lifetime. In your case you need to use manual logger and appender initialization. For example:
unique_ptr<plog::IAppender> g_appender;
unique_ptr<plog::Logger<PLOG_DEFAULT_INSTANCE>> g_logger;
void init()
{
g_appender.reset(new plog::RollingFileAppender<plog::TxtFormatter>("Hello.txt"));
g_logger.reset(new plog::Logger<PLOG_DEFAULT_INSTANCE>(plog::verbose));
g_logger->addAppender(g_appender.get());
}
void deinit()
{
g_logger.reset();
g_appender.reset();
}
Thus you have full control over the logger lifetime.
from plog.
Thanks, this works like a charm for me.
from plog.
Excellent. I leave the issue unresolved until I update the documentation.
from plog.
Related Issues (20)
- [Feature Request] Socket Appender HOT 4
- Log Message printed on Multiple times on Windows DLL when passing same log instance from .exe HOT 1
- [Feature Request] std::string to plog::nstring/plog::nchar HOT 2
- Why can I not create multiple loggers using dynamic instance id? HOT 1
- Function argument for use with plog HOT 2
- How can I dynamically create a Logger object? HOT 4
- always printf null HOT 2
- Roll log on application start HOT 2
- Log a packed argument list HOT 2
- Debug version using printf style alway cause Debug Assertion Failed! HOT 2
- Static linking of library HOT 2
- Release 1.1.10? HOT 6
- [Bug] When creating and assigning to logger - Compiler givers error: HOT 4
- [Feature Request] Single logger, but each appender has a different level HOT 4
- [Question] How to use Chained for multiple Classes within many DLL's
- \r\n for TxtFormatter in raw consoles HOT 4
- [Question] How to add custom prefix (record) information? HOT 2
- Can't add ConsoleAppender in a if statement HOT 2
- std::filesystem::path issue with new utf-8 mode on MSVC/Windows HOT 5
- Capture stdout and redirect to plog HOT 11
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 plog.