package logging

import "github.com/oslokommune/okctl/pkg/logging"

Package logging API for structured logging

Index

Functions

func AddLogFileHook

func AddLogFileHook(logger *logrus.Logger, logFile string) error

AddLogFileHook Add a Hook to write logs to rotating log files

func InitLogger

func InitLogger(logFile string) error

InitLogger initialize the global logger instance

Types

type Logger

type Logger interface {
	Trace(msg string)
	Debug(msg string)
	Info(msg string)
	Warn(msg string)
	Error(msg string)

	WithField(key string, value interface{}) Logger
}

Logger Interface for structured logging

func GetLogger

func GetLogger(component string, activity string) Logger

GetLogger returns a logger with the given component and activity as context fields on all log entries

Source Files

api.go logrus.go noop-logger.go types.go

Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
7 packages
Last checked
18 hours ago

Tools for package owners.