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

⚠️ Refactor logging structure, avoid mandatory Zap #290

Merged

Commits on Jan 14, 2019

  1. Logging structure refactor

    This splits up pkg/runtime/log into pkg/log, pkg/internal/log, and
    pkg/log/zap.
    
    - pkg/log contains generic logging helpers, and the generic root logger
      It *only* depends on logr, and thus won't pull in Zap if you don't
      need it.
    
    - pkg/internal/log contains the internal log handle (with the
      appropriate name).  Nothing outside CR should be logging with this
      handle anyway, so this enforces it.
    
    - pkg/log/zap contains Zap-related setup code, and thus CR only has a
      dependency on Zap if you pull in this package.
    
    - pkg/runtime/log remains as a deprecated package to ease refactoring
      and compatibility.  While practically a few types have been removed
      from this package, in reality most consumers shouldn't notice.
    DirectXMan12 committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    5f158d9 View commit details
    Browse the repository at this point in the history
  2. Switch internals over to new logging pkg layout

    This switches everything except alias.go over to the new package layout
    (mainly having internals use pkg/internal/log, and examples use
    pkg/log).
    DirectXMan12 committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    7207db7 View commit details
    Browse the repository at this point in the history
  3. Switch alias.go to new logging pkg layout

    This switches alias.go over to the new logging layout.  In order to
    avoid alias.go pulling in Zap, we don't put ZapLogger in alias.go any
    more.  Practically, this is probably fine.  It means an extra line in
    main.go, but it's just one, and allows people to avoid extraneous
    dependencies.
    DirectXMan12 committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    3c5adf4 View commit details
    Browse the repository at this point in the history