SergiusTheBest / plog

Portable, simple and extensible C++ logging library
MIT License
2.21k stars 391 forks source link

A few proposals #291

Open sashazxtt opened 2 months ago

sashazxtt commented 2 months ago
  1. Parameterize the RollingFileAppender It would be great if the RollingFileAppender could be parameterized on the File. Would be easy to plug in a custom file writer without changing the file management logic.
  2. Add ability to include a name of the 'facility' (Record::instanceId) to a log line. Would rely on an external functions to map an id to a string. Could be a template parameter to the formatters.
  3. Make logging of the 'this' and function optional. For now I did this:

    if defined LOG_THIS_AND_FUNC

        ss << record.getObject() << PLOG_NSTR(";");
        ss << record.getFunc() << PLOG_NSTR("@") << record.getLine() << PLOG_NSTR(";");

    endif

Thanks!

SergiusTheBest commented 2 months ago

It's interesting what another File implementation could be?

sashazxtt commented 2 months ago

At least one such option would be a ZIP file writer. Yes, there are some places that require log files to be encrypted and generally inaccessible to a local user. Another option would be remote logging - sending the file to a logging server. Maybe there are more options.

The encryption/encoding could be performed by a converter, of course, but that would be line-by-line and producing a standard .zip file would be difficult.