log

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 8 Imported by: 3

README

log

Build Status Travis

Logo

项目背景

功能开发日志打印是必不可少的, 之前使用ngaut开发的日志, 由于想支持函数名称的显示,所以就自己创建了
做二次开发,后续根据需要再增加其他功能。

功能说明

  1. 支持日志高亮
  2. 可以设置不同的日志级别
  3. 可以根据天或者小时进行日志拆分
  4. 日志支持函数名称、行、文件的记录,方便定位排查问题

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 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 SetCallerSkip added in v1.0.3

func SetCallerSkip(skip int)

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