che-operator/vendor/github.com/go-logr/zapr
Oleksandr Andriienko b8cc02bf9a
feat: Update controller runtime (#1064)
* Update controller runtime for che-operator and related deps.
Controller runtime update to version v0.9.5
go-client update to version v0.21.3
Udaptated tests to the new controller runtime and go-client.
Use newer image puller.

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
2021-10-01 14:54:37 +03:00
..
.gitignore Make che-operator non blocking (#212) 2020-04-10 17:19:14 +03:00
Gopkg.lock Operator sdk 0.15.2 (#515) 2020-11-11 11:15:55 -06:00
Gopkg.toml Operator sdk 0.15.2 (#515) 2020-11-11 11:15:55 -06:00
LICENSE Update vendor 2019-03-19 15:59:09 +02:00
README.md feat: Newer operator sdk (#826) 2021-07-19 14:29:11 +03:00
zapr.go feat: Update controller runtime (#1064) 2021-10-01 14:54:37 +03:00

README.md

Zapr

A logr implementation using Zap.

Usage

import (
    "fmt"

    "go.uber.org/zap"
    "github.com/go-logr/logr"
    "github.com/go-logr/zapr"
)

func main() {
    var log logr.Logger

    zapLog, err := zap.NewDevelopment()
    if err != nil {
        panic(fmt.Sprintf("who watches the watchmen (%v)?", err))
    }
    log = zapr.NewLogger(zapLog)

    log.Info("Logr in action!", "the answer", 42)
}

Implementation Details

For the most part, concepts in Zap correspond directly with those in logr.

Unlike Zap, all fields must be in the form of suggared fields -- it's illegal to pass a strongly-typed Zap field in a key position to any of the logging methods (Log, Error).

Levels in logr correspond to custom debug levels in Zap. Any given level in logr is represents by its inverse in Zap (zapLevel = -1*logrLevel).

For example V(2) is equivalent to log level -2 in Zap, while V(1) is equivalent to Zap's DebugLevel.