G3log is an asynchronous, "crash safe", logger that is easy to use with default logging sinks or you can add your own. G3log is made with plain C++14 (C++11 support up to release 1.3.2) with no external libraries (except gtest used for unit tests). G3log is made to be cross-platform, currently running on OSX, Windows and several Linux distros. See Readme below for details of usage.
Uncertain what's going on? Do you need advice or help troubleshooting?
I have the following class.
Unfortunately after I have called InitLogging() the log file is created and "InitCalled" is logged, but nothing is logged when I call Log().
The class is as an export class of a .DLL.
std::unique_ptr<g3::LogWorker> LogWorker = {g3::LogWorker::createLogWorker()};
std::unique_ptr<g3::FileSinkHandle> FileSink;
ExampleClass::ExampleClass(const string InstanceName)
{
LOGF(DEBUG, "ExcampleClass instance %s created", InstanceName.c_str ());
}
ExampleClass::~ExampleClass()
{
// not really needed, just to show the intention of usage, would like to shutdown filesink here
g3::internal::shutDownLoggingForActiveOnly(LogWorker.get());
}
ExampleClass::InitLogging()
{
LogWorker->addSink(std2::make_unique<g3::FileSink>("ExampleClass", "log/", InstanceName), g3::FileSink::fileWrite);
g3::initializeLogging(LogWorker.get());
LOG(INFO) << "Init called";
}
ExampleClass::Log()
{
LOG(INFO) << "Test";
}
Uncertain what's going on? Do you need advice or help troubleshooting?
I have the following class. Unfortunately after I have called InitLogging() the log file is created and "InitCalled" is logged, but nothing is logged when I call Log(). The class is as an export class of a .DLL.