log

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 4 Imported by: 13

README

Simple Log

Simple wrapper around zeroLog logger with simple interface

Exposes 3 log levels and returns an instance of a logger with set-able level and writer.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel string
const (
	DebugLvl LogLevel = "debug"
	InfoLvl  LogLevel = "info"
	ErrorLvl LogLevel = "error"
)

func ParseLevel added in v1.2.0

func ParseLevel(lvl string) LogLevel

ParseLevel returns a LogLevel if found by string If not found will default to error possible values are `error`, `debug`, `info`

type Logger

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

func New

func New(writer io.Writer, lvl LogLevel) Logger

func (Logger) Debug

func (l Logger) Debug(msg string)

func (Logger) Debugf

func (l Logger) Debugf(format string, args ...any)

func (Logger) Error

func (l Logger) Error(err error)

func (Logger) Errorf

func (l Logger) Errorf(format string, args ...any)

func (Logger) Info

func (l Logger) Info(msg string)

func (Logger) Infof

func (l Logger) Infof(format string, args ...any)

func (Logger) Level added in v1.2.0

func (l Logger) Level() LogLevel

Level returns the current logging level of the instance

func (Logger) Writer added in v1.2.0

func (l Logger) Writer() io.Writer

Writer returns the current writer of the logging instance

type Loggeriface

type Loggeriface interface {
	Debugf(format string, args ...any)
	Debug(msg string)
	Infof(format string, args ...any)
	Info(msg string)
	Errorf(format string, args ...any)
	Error(err error)
}

Jump to

Keyboard shortcuts

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