logr

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 4 Imported by: 2

README

Logur integration for Logr interface

GitHub Workflow Status Codecov Go Report Card Go Version go.dev reference

Installation

go get logur.dev/integration/logr

Usage

package main

import (
	"logur.dev/logur"
	logrintegration "logur.dev/integration/logr"
)

func main() {
	logger := logrintegration.New(logur.NewNoopLogger())
}

Development

When all coding and testing is done, please run the test suite:

$ make check

License

The MIT License (MIT). Please see License File for more information.

Documentation

Overview

Package logr provides Logur integration for Logr interface.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger logur.Logger) logr.Logger

New returns a new Logr logger.

Example
package main

import (
	"logur.dev/logur"

	logrintegration "logur.dev/integration/logr"
)

func main() {
	logger := logrintegration.New(logur.NoopLogger{})

	_ = logger
}
Output:

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a Logr logger.

func (*Logger) Enabled

func (l *Logger) Enabled(level int) bool

Enabled tests whether this InfoLogger is enabled.

func (*Logger) Error

func (l *Logger) Error(err error, msg string, keysAndValues ...interface{})

Error logs an error, with the given message and key/value pairs as context.

func (*Logger) Info

func (l *Logger) Info(level int, msg string, keysAndValues ...interface{})

Info logs a non-error message with the given key/value pairs as context.

func (*Logger) Init added in v0.5.0

func (l *Logger) Init(info logr.RuntimeInfo)

func (*Logger) WithName

func (l *Logger) WithName(name string) logr.LogSink

WithName adds a new element to the logger's name.

func (*Logger) WithValues

func (l *Logger) WithValues(keysAndValues ...interface{}) logr.LogSink

WithValues adds some key-value pairs of context to a logger.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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