Okay, i've been using boos.log libray for a while now, But at this moment, i have some special request, so here it is:
first, i want instead of boost posix time, to use unix timestamp, function like time(), or chrono::now(), i've implemented it like attrs::make_function(&to_time)) and then used it in stream. Question is: is it better to make my own attribute, and then use it, or just to use this make_function wrapper?
and second, i want to rotate file at the begging of every hour(not posix::hour(1)) i dont need time duration i need point in time. i also used a function wrapper keywords::time_based_rotation = boost::bind(&log::is_it_time_to_rotate,this), is there better way? because i find this not efficient, when i use same function 2 or 3 times?
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can use basic_clock attribute with your custom time traits. Performance wise make_function and basic_clock should be equivalent.
Custom predicate for time-based rotation is the intended way of extension. I'm not sure what inefficiency you mean. The library uses the same interface for its own time-based rotation predicates.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay, i've been using boos.log libray for a while now, But at this moment, i have some special request, so here it is:
first, i want instead of boost posix time, to use unix timestamp, function like time(), or chrono::now(), i've implemented it like attrs::make_function(&to_time)) and then used it in stream. Question is: is it better to make my own attribute, and then use it, or just to use this make_function wrapper?
and second, i want to rotate file at the begging of every hour(not posix::hour(1)) i dont need time duration i need point in time. i also used a function wrapper keywords::time_based_rotation = boost::bind(&log::is_it_time_to_rotate,this), is there better way? because i find this not efficient, when i use same function 2 or 3 times?
Regards.
You can use basic_clock attribute with your custom time traits. Performance wise make_function and basic_clock should be equivalent.
Custom predicate for time-based rotation is the intended way of extension. I'm not sure what inefficiency you mean. The library uses the same interface for its own time-based rotation predicates.