io

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 1 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package io provides a means of turning a log.Logger into an io.Writer for a chosen level. An example of this would be:

import(
    "io"
    "github.com/Masterminds/log-go"
    logio "github.com/Masterminds/log-go/io"
)

func main() {
    w := logio.NewCurrentWriter(log.InfoLevel)
    io.WriteString(w, "foo")
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrentWriter

type CurrentWriter struct {
	Level int
}

CurrentWriter uses the current package level logger for io writing

func NewCurrentWriter

func NewCurrentWriter(level int) *CurrentWriter

NewCurrentWriter creates a new CurrentWriter. The levels that can be passed to it are: - log.TraceLevel: - log.DebugLevel: - log.InfoLevel: - log.WarnLevel: - log.ErrorLevel: - log.PanicLevel: - log.FatalLevel:

func (CurrentWriter) Write

func (l CurrentWriter) Write(p []byte) (n int, err error)

Write is the write method from the io.Writer interface in the standard lib

type Writer

type Writer struct {
	Logger log.Logger
	Level  int
}

Writer uses the configured logger for io writing

func NewWriter

func NewWriter(lgr log.Logger, level int) *Writer

NewWriter creates a new Writer. It accepts a logger and a level that will be written on the io.Writer interface. The levels you can pass in are: - log.TraceLevel: - log.DebugLevel: - log.InfoLevel: - log.WarnLevel: - log.ErrorLevel: - log.PanicLevel: - log.FatalLevel:

func (Writer) Write

func (l Writer) Write(p []byte) (n int, err error)

Write is the write method from the io.Writer interface in the standard lib

Jump to

Keyboard shortcuts

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