logr

package module
v0.0.0-...-6cf8f6f Latest Latest
Warning

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

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

README

Phuslogr

Go Reference Go Report Card

A logr LogSink implementation using Phuslog.

Usage

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

func main() {
    logger := phuslogr.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 phuslogr.

Levels in phuslogr correspond to custom debug levels in Phuslog. Any given level in phuslogr 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