log

package module
v0.0.0-...-8f1b000 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: LGPL-3.0 Imports: 8 Imported by: 0

README

logging

Author

How To Use

Get the go code

go get -u github.com/EdenPP/log

Use the package


import "github.com/EdenPP/log"

func main() {


    filePath := "/var/log/test.log"
	
	// Set log level, suport 
	log.SetLevelByString("INFO")
	
	// set file path
	log.SetOutputByName(filePath)
	
	// rotate by houre
	log.SetRotateByHour()

}

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 FORMAT_TIME_DAY string = "20060102"
View Source
const FORMAT_TIME_HOUR string = "2006010215"

Variables

This section is empty.

Functions

func CrashLog

func CrashLog(file string)

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 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 Print

func Print(v ...interface{})

func Printf

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

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 SetOutputByName

func SetOutputByName(path string) error

func SetRotateByDay

func SetRotateByDay()

func SetRotateByHour

func SetRotateByHour()

func Warn

func Warn(v ...interface{})

func Warnf

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

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