boostorg / boostorg/log

Timezone information with text file backend

Open
#210 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
211
Forks
113
PR merge metrics
No merged PRs in 30d

Description

We're currently working on adding logging to our application and trying to get a log file in the following format: `test_20230607T165634+0200.log`

With the following code however, the resulting log file is `test_20230607T165634.log`. After reading the documentation is seems that boost log does not support any of the time zone flags, since it uses ptime internally (https://www.boost.org/doc/libs/1_82_0/doc/html/date_time/date_time_io.html#date_time.format_flags). Could support for this be added?

```
#include
#include

void init_logger(const std::string& filename)
{
auto sink = boost::log::add_file_log(boost::log::keywords::file_name = filename + "_%Y%m%dT%H%M%S%q.log");
}

int main(int, char**)
{
init_logger("test");

BOOST_LOG_TRIVIAL(info) << "Hello, World!";
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.