hclog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 5 Imported by: 0

README

back

Extracted from Go Microservice with Clean Architecture: Application Logging

Comparison of log library:

Different log libraries provide different features, some are important for debugging.

Logging information that is important (the following data are required):

  1. File name and line number
  2. Method name and caller name
  3. Message logging level
  4. Timestamp
  5. Error stack trace
  6. Automatically logging each function call with parameters and results

Logging from Awesome Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger is a logger that wraps the hc-log logger and has it conform to the log.Logger interface

func New

func New(lgr hclog.Logger) *Logger

New takes an existing hc-log logger and uses that for logging

func NewStandard

func NewStandard() *Logger

NewStandard returns a logger with a hc-log standard logger which it instantiates

func (Logger) Debug

func (l Logger) Debug(msg ...interface{})

func (Logger) Debugf

func (l Logger) Debugf(template string, args ...interface{})

func (Logger) Error

func (l Logger) Error(msg ...interface{})

func (Logger) Errorf

func (l Logger) Errorf(template string, args ...interface{})

func (Logger) Fatal

func (l Logger) Fatal(msg ...interface{})

func (Logger) Fatalf

func (l Logger) Fatalf(template string, args ...interface{})

func (Logger) Info

func (l Logger) Info(msg ...interface{})

func (Logger) Infof

func (l Logger) Infof(template string, args ...interface{})

func (*Logger) Level

func (l *Logger) Level(level ...levels.Type) levels.Type

func (*Logger) Named

func (l *Logger) Named(name string) *Logger

func (*Logger) Options

func (l *Logger) Options(funcs ...func(*Logger) *Logger) *Logger

func (Logger) Panic

func (l Logger) Panic(msg ...interface{})

func (Logger) Panicf

func (l Logger) Panicf(template string, args ...interface{})

func (*Logger) Prefix

func (l *Logger) Prefix(prefix ...string) string

func (Logger) Trace

func (l Logger) Trace(msg ...interface{})

func (Logger) Tracef

func (l Logger) Tracef(template string, args ...interface{})

func (Logger) Warn

func (l Logger) Warn(msg ...interface{})

func (Logger) Warnf

func (l Logger) Warnf(template string, args ...interface{})

func (*Logger) WithLevel

func (l *Logger) WithLevel(level levels.Type) *Logger

func (*Logger) WithLevelFromDebug

func (l *Logger) WithLevelFromDebug(debug bool) *Logger

Jump to

Keyboard shortcuts

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