gabime / spdlog

Fast C++ logging library.
Other
24.15k stars 4.51k forks source link

Rotating daily logger sink? #1806

Closed Nair-Sunil closed 3 years ago

Nair-Sunil commented 3 years ago

Is it possible to create a logger which creates a log daily with rotation after a certain size?. I know it is possible to achieve each of these functionalities individually by using either a rotating logger or daily logger.

gabime commented 3 years ago

There is such feature in spdlog.

Nair-Sunil commented 3 years ago

Thanks for the response. I tried out couple of options as below: _logger = spdlog::daily_logger_mt("server_FD_logger", logPath, 23, 59, false, max_files); This creates a log file daily at 23:59 but no rotation after certain size

_logger = spdlog::rotating_logger_mt("fast_message_logger", logPath, max_size, max_files); This creates a rotating logger but no daily logs

I need something which is a hybrid of both the features

yalov commented 4 months ago

There is no such feature in the spdlog: a sink that combine daily_file and rotating_file,

or more common: a sink, that will rotate both by time and size