logger

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: MIT Imports: 5 Imported by: 0

README

logger

logger engine based on zap framework

Installation

go get github.com/assetto-io/logger

Usage

In order to use the library you need to import the corresponding package:

import "github.com/assetto-io/logger"

Performing Logging calls

The logger module provides convenient methods that you can use to perform different logging calls.

Info
logger.Info("some kind of event")
Error
if err := whoops.MethodWithError; err != nil {
    logger.Error("some kind of event", err)
}
Working with tags
url := "http://test.com"
request := NewCustomRequest()

if err := whoops.PerformRequest(url, request); err != nil {
    logger.Error("some kind of event", err, logger.Field(url, request))
}

Documentation

Index

Constants

View Source
const (
	DebugLvl = "debug"
	InfoLvl  = "info"
	ErrorLvl = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogField added in v1.0.3

type LogField struct {
	Key   string
	Value interface{}
}

func Field

func Field(key string, value interface{}) LogField

type Logger added in v1.0.3

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

func New added in v1.0.3

func New(name string, lvl string) (*Logger, error)

func (*Logger) Debug added in v1.0.3

func (l *Logger) Debug(msg string, tags ...LogField)

func (*Logger) Error added in v1.0.3

func (l *Logger) Error(msg string, err error, tags ...LogField)

func (*Logger) Info added in v1.0.3

func (l *Logger) Info(msg string, tags ...LogField)

Jump to

Keyboard shortcuts

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