Clone elog.
git clone https://github.com/ahakan/elog.git
cd elog
mkdir build && cd build
cmake ..
make
Copy src file with libelog.so and inc file to your project library folder and use it!
What to do for console output?
ELOG_OUTPUT(Elog::LogOutput::Console);
What to do to write to file?
ELOG_OUTPUT(Elog::LogOutput::File);
How to set log level?
ELOG_LEVEL(Elog::LogLevel::Info); => Info, Debug, Warning, Error
ELOG_LEVEL(Elog::LogLevel::Debug); => Debug, Warning, Error
ELOG_LEVEL(Elog::LogLevel::Warning); => Warning, Error
ELOG_LEVEL(Elog::LogLevel::Error); => Error
If you want you can change the default configurations.
ELOG_FILESIZE(Elog::ByteSize::MB1);
ELOG_FILEPREFIX("app");
ELOG_FILESUFFIX(".log");
ELOG_TIDCOLSIZE(Elog::Size::Six);
ELOG_LINECOLSIZE(Elog::Size::Five);
ELOG_LEVELCOLSIZE(Elog::Size::Eight);
ELOG_FILENAMECOLSIZE(Elog::Size::Ten);
ELOG_FUNCNAMECOLSIZE(Elog::Size::Ten);
#include "elog.h"
int main()
{
ELOG_LEVEL(Elog::LogLevel::Info);
ELOG_OUTPUT(Elog::LogOutput::File);
ELOG_FILESIZE(Elog::ByteSize::MB1);
int i = 0;
std::string world = "world!";
ELOG(INFO, "Hello, %s", world.c_str());
ELOG(DEBUG, "Hello, %d", i);
ELOG(WARNING, "Hello, %s", "world!");
ELOG(ERROR, "Hello, %s", "world!");
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.