Closed mkirzon closed 3 years ago
I get R Version with:
paste0(R.Version()[c("major","minor")], collapse = ".")
I get package version with:
ns = get_logger_meta_variables()$ns
if (ns != "global") NULL else as.character(utils::packageVersion(ns))
This is a cool idea, please let me know if #64 works for your use case.
Yes! That's exactly it... didn't expect such a quick turnaround :)
An unrelated question (please let me know if i should open a separate issue):
In this same application that I uncovered this need, I have one more need around skipping logging under certain conditions. I created my own appender (since I'm writing to a database through a stored procedure). However, is there a way to exit the logger from within the appender? For example, could I exit prematurely (e.g. return(NULL)
) under certain conditions? Or from other custom components for that matter (e.g. from within my own layout)?
Hm, regarding skipping logging conditionally -- do you really need to make that decision in the layout function? :thinking: That seems like against the overall design of the log threshold/formatter/layout/appender design.
Anyway, feel free to open a ticket to track that discussion, but no promises.
If you know the conditions outside of the layout fn etc, wrap your logging fn in with_log_threshold
.
I love using this logger, but had to customize my layout function to be able to include new variables. I find it useful to also capture R Version, and package version (ie namespace version if namespace is a package). Can these be added to
get_logger_meta_variables
?