logr

package module
v0.0.0-...-fa7d74c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 2 Imported by: 0

README

log/logr

Go Reference Go Report Card

A logr LogSink implementation.

Usage

import (
    "github.com/phuslu/log/logr"
    "github.com/phuslu/log"
)

func main() {
    logger := logr.New(&log.Logger{
        Level:      log.InfoLevel,
        TimeFormat: "15:04:05",
        Caller:     1,
        Writer: &log.ConsoleWriter{
            ColorOutput:    true,
            QuoteString:    false,
            EndWithMessage: false,
        },
    })

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

Implementation Details

For the most part, concepts in Phuslog correspond directly with those in log/logr.

Levels in log/logr correspond to custom debug levels in Phuslog. Any given level in log/logr is represents by phuslogLevel = 1 - logrLevel.

For example V(2) is equivalent to Phuslog's TraceLevel, while V(1) is equivalent to Phuslog's DebugLevel.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger *log.Logger) logr.Logger

New returns a new logr.Logger instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL