slog icon indicating copy to clipboard operation
slog copied to clipboard

nRotate doesnt prevent new File for every day

Open SirGamsay opened this issue 8 months ago • 0 comments

Hey, firstly thank you for you Library. For the most part it works great in my Project :)

However I do have an Issue with the nRotate Flag.

from the README

nRotate uint8_t 1 (enabled) Create new log file for each day.

So accordingly I did the following for my configuration:

slog_config_t cfg;
int nEnabledLevels = SLOG_FLAGS_ALL; 
const char *logFile = "/var/log/openvpn-client/application.log";
slog_init(logFile, nEnabledLevels, 0);
slog_config_get(&cfg);
cfg.nToFile = 1;
cfg.nToScreen = 1;  
cfg.sFilePath[0] = '/';
cfg.nIndent = 1;
cfg.nRotate = 0;        // Doesn't work
cfg.eColorFormat = SLOG_COLORING_DISABLE;   
slog_config_set(&cfg);
slog_debug("Test");

Which does produce

$ ls /var/log/openvpn-client/
application.log-2024-06-19.log ...

Even with the nRotate Flag set to 0, slog creates a new Log File for every Day.

SirGamsay avatar Jun 19 '24 20:06 SirGamsay