-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding minute_file_sink_mt #2727
Comments
logtest.cpp.txt Driver code and sink files attached for reference.Appreciate your help |
In
But declared
|
Hourly Logger define as below, I just modify to support minutes
This is how driver program define it. //auto file_logger = spdlog::hourly_logger_mt("vxRadProbe", logfilename,false,72);//keep 3 days(72 Hrs) Can you advice how it differed as above is working fine with hourly logger. |
Look at the constructor arguments carefully. |
It was hard to tell what you were doing wrong, but I think I might have figured it out. In this line, you have made the mistake of calling the constructor with the intention of calling a factory function. spdlog::sinks::minute_file_sink_mt("basic_logger", "logs/min-log.txt",false,72); What is being called is the
And what you wanted to call would be the following factory function //
// factory functions
//
template<typename Factory = spdlog::synchronous_factory>
inline std::shared_ptr<logger> minute_logger_mt(const std::string &logger_name, const filename_t &filename, bool truncate = false,
uint16_t max_files = 0, const file_event_handlers &event_handlers = {})
{
return Factory::template create<sinks::minute_file_sink_mt>(logger_name, filename, truncate, max_files, event_handlers);
} They have different namespaces and symbol names. |
Thanks for quick advice, It's fixed once i call the minute_logger_mt from driver code. You save my day!!! Sample Log: P.S:: Can we merge this code with project? |
PR is welcome. |
I will send shortly. |
Unfortunately, I am not the maintainer of this repository and do not have merge privileges. |
Hope some one will check and merge this PR |
@mmanoj Any news on this? |
@gabime , Thank you for your patience, I was busy with some urgent project task. I will be start working on this next week.I will keep you posted. |
@gabime for example how to run test_daily_logger.cpp |
Run $ cmake .
$ ctest
# Run test target.
$ ctest spdlog-utests Note the only spdlog test targets are See also: |
I created basic sink implementation as attached and driver code. However getting below errors. Please advice to fix it and if all fine we can merge with project.
===================
Errors
`logtest.cpp: In function ‘void setupLogging()’:
logtest.cpp:17:101: error: no matching function for call to ‘spdlog::sinks::minute_file_sinkstd::mutex::minute_file_sink(const char [13], const char [17], bool, int)’
17 | auto logger = spdlog::sinks::minute_file_sink_mt("basic_logger", "logs/min-log.txt",false,72);
| ^
In file included from logtest.cpp:10:
../include/spdlog/sinks/minute_file_sink.h:49:5: note: candidate: ‘spdlog::sinks::minute_file_sink<Mutex, FileNameCalc>::minute_file_sink(spdlog::filename_t, bool, uint16_t, const spdlog::file_event_handlers&) [with Mutex = std::mutex; FileNameCalc = spdlog::sinks::minute_filename_calculator; spdlog::filename_t = std::__cxx11::basic_string; uint16_t = short unsigned int]’
49 | minute_file_sink(
| ^~~~~~~~~~~~~~~~
../include/spdlog/sinks/minute_file_sink.h:50:109: note: no known conversion for argument 4 from ‘int’ to ‘const spdlog::file_event_handlers&’
50 | filename_t base_filename, bool truncate = false, uint16_t max_files = 0, const file_event_handlers &event_handlers = {})
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
`
The text was updated successfully, but these errors were encountered: