logger

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package Logger provides a singleton which allows consistent logging across the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableStandardLogs added in v0.1.18

func DisableStandardLogs()

DisableStandardLogs disables logs created with the standard library global logger

func Get

func Get() *sypl.Sypl

Get returns the logger. If the logger isn't configured, it will exit with fatal.

func RedirectStandardLogs added in v0.1.18

func RedirectStandardLogs()

RedirectStandardLogs redirects logs created with the standard library global logger to the ProxyLogger.

func Setup

func Setup(o *Options) *sypl.Sypl

Setup logger. If it fails to set up, it will exit with fatal.

Types

type Options

type Options struct {
	// Allows to set the internal Logger. For now, it will be straightforward
	// Sypl logger. In the future, could be the `sypl.IBasicPrinter` interface.
	Logger *sypl.Sypl `json:"-"`

	FileLevel string `validate:"required,gte=3"`
	FilePath  string `validate:"required"`
	Level     string `validate:"required,gte=3"`
}

Options for logging .

func (*Options) Default

func (o *Options) Default()

Default sets `Options` default values.

type ProxyLogger added in v0.1.9

type ProxyLogger struct {
	Logger *sypl.Sypl
}

ProxyLogger exist to satisfy `goproxy` logging interface.

func (*ProxyLogger) Printf added in v0.1.9

func (pL *ProxyLogger) Printf(format string, v ...interface{})

Printf satisfies `goproxy` logging interface. Default logging level will be `Debug`.

type StandardLogger added in v0.1.18

type StandardLogger struct {
	Logger *sypl.Sypl
}

func (*StandardLogger) Write added in v0.1.18

func (pL *StandardLogger) Write(p []byte) (int, error)

Write satisfies the standard logging interface. Default logging level will be `Debug`.

Jump to

Keyboard shortcuts

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