daroczig/logger

doc bug?

r2evans opened this issue · 3 comments

When I run the example code in ?formatter_json, the example code includes

     log_formatter(formatter_json())

While this itself doesn't err, it does when I try to use it.

log_formatter(formatter_json())
log_info("hello")
# Error in `[]`("hello", .logcall = log_info("hello"), .topcall = NA, .topenv = <environment>) : 
#   could not find function "[]"

Since the argument should be a function, I believe it should be just log_formatter(formatter_json) (since formatter_json() returns the string literal "[]" ... which makes sense, since it was passed no arguments and returns an empty json list.

packageVersion("logger")
# [1] ‘0.2.2’
R.version
#                _                           
# platform       x86_64-pc-linux-gnu         
# arch           x86_64                      
# os             linux-gnu                   
# system         x86_64, linux-gnu           
# status                                     
# major          4                           
# minor          3.2                         
# year           2023                        
# month          10                          
# day            31                          
# svn rev        85441                       
# language       R                           
# version.string R version 4.3.2 (2023-10-31)
# nickname       Eye Holes                   

Yeah, thanks for pointing out. I've run into the same the other day and fixed at
https://github.com/daroczig/logger/pull/146/files#diff-6fc9712995f40cc7e45bfc9c77a3e85ac5d6b06760efe0d4f6618b5e33d376e2L148 - to be merged with #146

I had checked your code but not the PR list yet, sorry if this is a dupe :-)

It's weird when people actually read documentation ... with some of my clients, it's just something I pour time into so that when they ask me questions, I know where to reference the answer for them (though they had it themselves).

#146 is now merged, so this should be fixed. Thanks again!