logger

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	LoggerOutputTypeStdOut = logapi.LoggerOutputTypeStdOut
	LoggerOutputTypeFile   = logapi.LoggerOutputTypeFile
)
View Source
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel = logapi.PanicLevel
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel = logapi.FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel = logapi.ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel = logapi.WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel = logapi.InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel = logapi.DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel = logapi.TraceLevel
)

Variables

This section is empty.

Functions

func Log

func Log(level Level, args ...interface{})

Log wrap level and field

Example
package main

import (
	"github.com/commcos/utils/logger"
)

func main() {
	logger.SetLogLevel(logger.TraceLevel)
	logger.Log(logger.InfoLevel, "url", "test")

}
Output:

func Logf

func Logf(level Level, template string, args ...interface{})

LogF wrap level and field

func SetLogLevel

func SetLogLevel(level Level)

InitLogger init logger

func SetLoggerOutputConfig

func SetLoggerOutputConfig(conf LoggerOutputFileConf)

func SetLoggerOutputType

func SetLoggerOutputType(outputType LoggerOutputType)

Types

type Fields

type Fields = logapi.Fields

Fields log fields

type Level

type Level = logapi.Level

Level logger level

func LogLevel

func LogLevel() Level

type LoggerOutputFileConf

type LoggerOutputFileConf = logapi.LoggerOutputFileConf

type LoggerOutputType

type LoggerOutputType = logapi.LoggerOutputType

Jump to

Keyboard shortcuts

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