{"action":"created","issue":{"url":"https://api.github.com/repos/gabime/spdlog/issues/726","repository_url":"https://api.github.com/repos/gabime/spdlog","labels_url":"https://api.github.com/repos/gabime/spdlog/issues/726/labels{/name}","comments_url":"https://api.github.com/repos/gabime/spdlog/issues/726/comments","events_url":"https://api.github.com/repos/gabime/spdlog/issues/726/events","html_url":"https://github.com/gabime/spdlog/issues/726","id":331499586,"node_id":"MDU6SXNzdWUzMzE0OTk1ODY=","number":726,"title":"daily_file_sink don't work as expected","user":{"login":"LeeGaning","id":12764014,"node_id":"MDQ6VXNlcjEyNzY0MDE0","avatar_url":"https://avatars2.githubusercontent.com/u/12764014?v=4","gravatar_id":"","url":"https://api.github.com/users/LeeGaning","html_url":"https://github.com/LeeGaning","followers_url":"https://api.github.com/users/LeeGaning/followers","following_url":"https://api.github.com/users/LeeGaning/following{/other_user}","gists_url":"https://api.github.com/users/LeeGaning/gists{/gist_id}","starred_url":"https://api.github.com/users/LeeGaning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeeGaning/subscriptions","organizations_url":"https://api.github.com/users/LeeGaning/orgs","repos_url":"https://api.github.com/users/LeeGaning/repos","events_url":"https://api.github.com/users/LeeGaning/events{/privacy}","received_events_url":"https://api.github.com/users/LeeGaning/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-06-12T09:03:24Z","updated_at":"2018-07-12T22:45:32Z","closed_at":"2018-07-12T22:45:32Z","author_association":"NONE","body":"```c\r\nstruct custom_daily_file_name_calculator\r\n{\r\n    static spdlog::filename_t calc_filename(const spdlog::filename_t& filename)\r\n    {\r\n        std::tm tm = spdlog::details::os::localtime();\r\n        spdlog::filename_t basename, ext;\r\n        std::tie(basename, ext) = spdlog::details::file_helper::split_by_extenstion(filename);\r\n        fmt::MemoryWriter w;\r\n        w.write(\"{}_{:04d}{:02d}{:02d}{}\", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, ext);\r\n        return w.str();\r\n    }\r\n};\r\n\r\nint main(int argc, char *argv[]) {\r\n    using sink_type = spdlog::sinks::daily_file_sink<std::mutex,custom_daily_file_name_calculator>;\r\n    spdlog::set_error_handler([](const std::string &msg) {\r\n        std::cerr << \"spdlog err handler: \" << msg << std::endl;\r\n    });\r\n    //calculate filename (time based)\r\n    std::string basename = \"logs/udpserv.txt\";\r\n    auto main_logger = spdlog::create<sink_type>(\"main_logger\", basename, 0, 0);\r\n    spd::set_level(spd::level::debug);\r\n    main_logger->info(\"Welcome to spdlog!\");\r\n    ......\r\n}\r\n```\r\n```shell\r\n-rw-r--r-- 1 root root 301M May 27 00:00 udpserv_20180526.log\r\n-rw-r--r-- 1 root root 303M May 28 00:00 udpserv_20180527.log\r\n-rw-r--r-- 1 root root 309M May 29 00:00 udpserv_20180528.log\r\n-rw-r--r-- 1 root root 324M May 30 00:00 udpserv_20180529.log\r\n-rw-r--r-- 1 root root 337M May 31 00:00 udpserv_20180530.log\r\n-rw-r--r-- 1 root root 341M Jun  1 00:00 udpserv_20180531.log\r\n-rw-r--r-- 1 root root 345M Jun  2 00:00 udpserv_20180601.log\r\n-rw-r--r-- 1 root root 347M Jun  3 00:00 udpserv_20180602.log\r\n-rw-r--r-- 1 root root 343M Jun  4 00:00 udpserv_20180603.log\r\n-rw-r--r-- 1 root root 710M Jun  6 00:00 udpserv_20180604.log\r\n-rw-r--r-- 1 root root 359M Jun  7 00:00 udpserv_20180606.log\r\n-rw-r--r-- 1 root root 359M Jun  8 00:00 udpserv_20180607.log\r\n-rw-r--r-- 1 root root 365M Jun  9 00:00 udpserv_20180608.log\r\n-rw-r--r-- 1 root root 373M Jun 10 00:00 udpserv_20180609.log\r\n-rw-r--r-- 1 root root 378M Jun 11 00:00 udpserv_20180610.log\r\n-rw-r--r-- 1 root root 645M Jun 12 16:47 udpserv_20180611.log\r\n```\r\nI want to  generate a new filename every day at 00:00;but sometimes It don't work as expected;\r\n20180605->daily_file_sink don't  generate a new filename；\r\n20180612->daily_file_sink don't  generate a new filename；"},"comment":{"url":"https://api.github.com/repos/gabime/spdlog/issues/comments/404673693","html_url":"https://github.com/gabime/spdlog/issues/726#issuecomment-404673693","issue_url":"https://api.github.com/repos/gabime/spdlog/issues/726","id":404673693,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDY3MzY5Mw==","user":{"login":"gabime","id":6052198,"node_id":"MDQ6VXNlcjYwNTIxOTg=","avatar_url":"https://avatars3.githubusercontent.com/u/6052198?v=4","gravatar_id":"","url":"https://api.github.com/users/gabime","html_url":"https://github.com/gabime","followers_url":"https://api.github.com/users/gabime/followers","following_url":"https://api.github.com/users/gabime/following{/other_user}","gists_url":"https://api.github.com/users/gabime/gists{/gist_id}","starred_url":"https://api.github.com/users/gabime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabime/subscriptions","organizations_url":"https://api.github.com/users/gabime/orgs","repos_url":"https://api.github.com/users/gabime/repos","events_url":"https://api.github.com/users/gabime/events{/privacy}","received_events_url":"https://api.github.com/users/gabime/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T22:45:31Z","updated_at":"2018-07-12T22:45:31Z","author_association":"OWNER","body":"Fixed in v1.x branch"}}
{"actor":{"display_login":"gabime"}}