logging

package module
v0.0.0-...-cfa683b Latest Latest
Warning

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

Go to latest
Published: May 30, 2015 License: LGPL-3.0 Imports: 7 Imported by: 0

README

logging

Documentation

Overview

high level log wrapper, so it can output different log based on level

Index

Constants

View Source
const (
	Ldate         = log.Ldate
	Llongfile     = log.Llongfile
	Lmicroseconds = log.Lmicroseconds
	Lshortfile    = log.Lshortfile
	LstdFlags     = log.LstdFlags
	Ltime         = log.Ltime
)
View Source
const (
	LOG_FATAL   = LogType(0x1)
	LOG_ERROR   = LogType(0x2)
	LOG_WARNING = LogType(0x4)
	LOG_INFO    = LogType(0x8)
	LOG_DEBUG   = LogType(0x10)
)
View Source
const (
	LOG_LEVEL_NONE  = LogLevel(0x0)
	LOG_LEVEL_FATAL = LOG_LEVEL_NONE | LogLevel(LOG_FATAL)
	LOG_LEVEL_ERROR = LOG_LEVEL_FATAL | LogLevel(LOG_ERROR)
	LOG_LEVEL_WARN  = LOG_LEVEL_ERROR | LogLevel(LOG_WARNING)
	LOG_LEVEL_INFO  = LOG_LEVEL_WARN | LogLevel(LOG_INFO)
	LOG_LEVEL_DEBUG = LOG_LEVEL_INFO | LogLevel(LOG_DEBUG)
	LOG_LEVEL_ALL   = LOG_LEVEL_DEBUG
)
View Source
const (
	LogSuffixFormat      = "2006-01-02"  // 15:04:05.999999999"
	LogFileCheckDuration = 1 * time.Hour //1 * time.Second
	LogFileMaxSize       = 1024 * 1024
	MaxLogFiles          = 30
)

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func Error

func Error(v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Fatal

func Fatal(v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func InitLogToFile

func InitLogToFile(logDir string, namePrefix string) error

func LogTypeToString

func LogTypeToString(t LogType) (string, string)

func Logger

func Logger() *log.Logger

func New

func New() *logger

func Newlogger

func Newlogger(w io.Writer, prefix string) *logger

func SetFlags

func SetFlags(flags int)

func SetHighlighting

func SetHighlighting(highlighting bool)

func SetLevel

func SetLevel(level LogLevel)

func SetLevelByString

func SetLevelByString(level string)

func SetOutput

func SetOutput(out io.Writer)

func Warning

func Warning(v ...interface{})

func Warningf

func Warningf(format string, v ...interface{})

Types

type LogLevel

type LogLevel int

func GetLogLevel

func GetLogLevel() LogLevel

func StringToLogLevel

func StringToLogLevel(level string) LogLevel

type LogType

type LogType int

Jump to

Keyboard shortcuts

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