Giter VIP home page Giter VIP logo

logr's People

Contributors

cubranic avatar

Watchers

 avatar  avatar

logr's Issues

Add a parameter to `with_logging` to control system message handling

Jenny found it very surprising that message output was being let through the console despite the threshold 'console=WARN'. This happens because the system logging handler, which handles these conditions, currently:

output(s) only to logging outputs other than stderr(). The handler does not invoke any restarts, so the handling will pass on to any other active handlers up the calling chain. It is assumed that one of those will output a message to the console, if the user hasn't suppressed it.

In our last meeting, we discussed having this behaviour controlled by an additional parameter to with_logging, with the default being to handle system messages exactly the same way as regular logging messages. However, the existing behaviour could still be turned on by the caller if so desired.

Write a help page for `format_message`

Mark it internal as suggested in the roxygen vignette:

Using the [@keywords internal] removes all functions in the associated .Rd file from the documentation index and disables some of their automated tests. A common use case is to both export a function (using @export) and marking it as internal. That way, advanced users can access a function that new users would be confused about if they were to see it in the index.

Do we need a FATAL level?

Log4j, and on the R side futile.logger and log4r (but not logging), distinguish between FATAL and ERROR messages. Here is one description:

  • FATAL: very severe error events that will presumably lead the application to abort.
  • ERROR: error events that might still allow the application to continue running

Default to no wrapping of messages shorter than `getOption('width')`

I have formatted some text where the whitespace is very important. When I log via warn(), it oversteps its mandate and edits (mostly deletes) the whitespace.

Example:

d> warn(c("0: foo", "1:         yo"))
0: foo
1: yo

Same goes for error(), info(), debug(), and trace(), so I'm blaming logr().

Hide `with_logging` internals from the call element of the `stop`'s error message

Calling stop from within the expr argument to with_logging outputs an error message that's confusing and unnecessarily reveals internals of with_logging:

> with_logging(stop('foo'))
Error in withCallingHandlers(expr, LoggingMessage = make_logging_handler(log_outputs),  (from logging.R#51) : 
  foo

Instead, we should probably use the call to with_logging as the reported location of the error instead of withCallingHandlers.

(First reported in jennybc/fh2#31)

Translate ERROR and WARN messages to errors and warnings when no active loggers

Currently, add_log detects when no active loggers are present and in that case uses message to output it regardless of the level. It could be a little smarter and do different things depending on the log message level. For instance, if ERROR were output with stop, WARN with warning, and INFO with message, while DEBUG and TRACE were not output at all, we would have a sensible out-of-the-box default behaviour even if the user does not bother to run the code within with_logging.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.