Skip to content
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

RFC: Base logging #24490

Merged
merged 9 commits into from
Dec 15, 2017
Merged

RFC: Base logging #24490

merged 9 commits into from
Dec 15, 2017

Commits on Dec 15, 2017

  1. Copy of MicroLogging core.jl (897172e) -> logging.jl

    This is a straight copy - not useful by itself, but as a reference point
    for porting further changes.
    c42f committed Dec 15, 2017
    Configuration menu
    Copy the full SHA
    ec3920d View commit details
    Browse the repository at this point in the history
  2. Logging updates required for Base porting effort

    * Remove 0.6 compatibility junk
    
    * Ensure logging macros can be used earlier in Base
    
    * Remove unnecessary types from core logging method defaults
    
    * max_log -> maxlog for log limiting
    
    * Beef up SimpleLogger a little to avoid temporary buffer async issues,
      respect maxlog, and make log colorization more consistent.  It can be
      re-simplified again once there's a viable alternative in stdlib Logging.
    
    * Hash entire expression for log event ids.  This makes ids more likely
      to be unique before deduplication, which makes them more likely to be
      stable.
    c42f committed Dec 15, 2017
    Configuration menu
    Copy the full SHA
    dfcfb27 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    332c05e View commit details
    Browse the repository at this point in the history
  4. Move logger state to explicitly reside in Task

    This seems to be the simplest way to tackle two problems:
    
    * Tasks should inherit the logger state from the parent task.  If not,
      all new tasks will use the global logger, which is unlikely to be
      what you want. In particular, the use of `@ async` in `Pkg` means we
      need something along these lines.
    
    * The cost of looking up the current log level in the Task local state
      dictionary is expensive when we want to discard a lot of potential
      Debug messages as quickly as possible.
    c42f committed Dec 15, 2017
    Configuration menu
    Copy the full SHA
    4614dae View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2f57595 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    524301f View commit details
    Browse the repository at this point in the history
  7. Migrate Base to logging macros

    For messages this was a somewhat mechanical upgrade assisted by
    Deprecations.jl.  Some messages are lightly edited for consistency:
    
    * Where exceptions were interpolated, they're instead added as keyword
      arguments: `exception=ex`
    
    * An attempt has been made to punctuate log messages consistently with
      the convention from pkg: Short messages start with a capital, but have
      no period.
    
    * In places where the log message is generated using logic, the logic is
      pulled inside the message generation block.  (Good practise from a
      scoping and efficiency point of view.)
    
    Notes on other changes:
    
    * `warn_once()` use has been replaced with the annotation `maxlog=1`.
      This depends on the logging backend to honor it, but makes things
      much more flexible.
    
    * `warnbanner()` use has been replaced with markdown formatted versions
      of `@ warn`
    
    * Avoid use display_error outside of REPL, thereby removing the
      log_error_to dependency
    
    * A few uses of bare println() have been replaced with logging
    
    * depwarns go to the new system, and use the frame address as the key
      for a speedy first pass at deduplication.  A full depwarn report can
      be created in the future by collecting the log records
    
    * Port all logging tests to use test_logs where possible rather than
      reading streams.
    
    * Exceptions caught while executing commands on the REPL always go to
      the REPL output stream rather than being logged to the current logger,
      under the premise that this feedback is "normal output" for the REPL.
    
    Areas for further improvement:
    
    * A few remaining tests still use test_warn, as they call separate julia
      processes where the log records aren't yet forwarded transparently.
    
    * Tests for deprecated functionality are disabled in depwarn=error mode.
      It would be better to remove depwarn=error and rely on a logger
      instead.
    c42f committed Dec 15, 2017
    Configuration menu
    Copy the full SHA
    7f434c0 View commit details
    Browse the repository at this point in the history
  8. Deprecate old logging info(), warn(), logging()

    To capture messages from Base, users should install a logger instead,
    for example, using `with_logger()`.
    c42f committed Dec 15, 2017
    8 Configuration menu
    Copy the full SHA
    5d77d1b View commit details
    Browse the repository at this point in the history
  9. Add NEWS for logging changes

    c42f committed Dec 15, 2017
    Configuration menu
    Copy the full SHA
    1845bdb View commit details
    Browse the repository at this point in the history