log

package
v0.0.0-...-4845449 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

nolint:forbidigo // allow usage of the "zap" package

Index

Constants

View Source
const (
	DebugLevel = zapcore.DebugLevel
	InfoLevel  = zapcore.InfoLevel
	WarnLevel  = zapcore.WarnLevel
	ErrorLevel = zapcore.ErrorLevel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugLogger

type DebugLogger interface {
	Logger
	ConnectTo(writer io.Writer)
	Truncate()
	AllMessages() string
	DebugMessages() string
	InfoMessages() string
	WarnMessages() string
	WarnAndErrorMessages() string
	ErrorMessages() string
}

DebugLogger returns logs as string in tests.

func NewDebugLogger

func NewDebugLogger() DebugLogger

NewDebugLogger returns logs as string by String() method. See also other methods of the ioutil.Writer.

type File

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

func NewLogFile

func NewLogFile(path string) (*File, error)

NewLogFile creates a log file defined in the flags or create a temp file. Log file can be outside project directory, so it is NOT using virtual filesystem.

func (*File) File

func (f *File) File() *os.File

func (*File) IsTemp

func (f *File) IsTemp() bool

func (*File) Path

func (f *File) Path() string

func (*File) TearDown

func (f *File) TearDown(errorOccurred bool)

type LevelWriter

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

func (*LevelWriter) Close

func (w *LevelWriter) Close() error

func (*LevelWriter) Write

func (w *LevelWriter) Write(p []byte) (n int, err error)

Write messages with the defined level to zapLogger.

func (*LevelWriter) WriteNoErr

func (w *LevelWriter) WriteNoErr(p []byte)

func (*LevelWriter) WriteString

func (w *LevelWriter) WriteString(s string)

func (*LevelWriter) WriteStringIndent

func (w *LevelWriter) WriteStringIndent(indent int, s string)

type Logger

type Logger interface {
	// contains filtered or unexported methods
}

func NewCliLogger

func NewCliLogger(stdout io.Writer, stderr io.Writer, logFile *File, verbose bool) Logger

NewCliLogger new production zapLogger for CLI.

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger returns no operation log. The logs are discarded.

type MemoryLogger

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

func NewMemoryLogger

func NewMemoryLogger() *MemoryLogger

func (*MemoryLogger) CopyLogsTo

func (l *MemoryLogger) CopyLogsTo(target Logger)

func (MemoryLogger) DebugWriter

func (l MemoryLogger) DebugWriter() *LevelWriter

func (MemoryLogger) ErrorWriter

func (l MemoryLogger) ErrorWriter() *LevelWriter

func (MemoryLogger) InfoWriter

func (l MemoryLogger) InfoWriter() *LevelWriter

func (MemoryLogger) WarnWriter

func (l MemoryLogger) WarnWriter() *LevelWriter

func (MemoryLogger) With

func (l MemoryLogger) With(args ...interface{}) Logger

With creates a child logger and adds structured context to it.

type PrefixLogger

type PrefixLogger interface {
	Logger
	Prefix() string
	WithPrefix(prefix string) PrefixLogger
}

func NewApiLogger

func NewApiLogger(base *stdLog.Logger, prefix string, verbose bool) PrefixLogger

NewApiLogger new production zapLogger for API.

Jump to

Keyboard shortcuts

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