golog

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

README

golog

go get -d github.com/andals/golog

doc

Documentation

Index

Constants

View Source
const (
	ASYNC_MSG_KIND_LOG          = 1
	ASYNC_MSG_KIND_FLUSH        = 2
	ASYNC_MSG_KIND_FREE_LOGGER  = 3
	ASYNC_MSG_KIND_FREE_ROUTINE = 4
)
View Source
const (
	LEVEL_DEBUG     = 1
	LEVEL_INFO      = 2
	LEVEL_NOTICE    = 3
	LEVEL_WARNING   = 4
	LEVEL_ERROR     = 5
	LEVEL_CRITICAL  = 6
	LEVEL_ALERT     = 7
	LEVEL_EMERGENCY = 8
)
View Source
const (
	SPLIT_BY_DAY  = 1
	SPLIT_BY_HOUR = 2
)
View Source
const (
	TIME_FMT_STR_YEAR   = "2006"
	TIME_FMT_STR_MONTH  = "01"
	TIME_FMT_STR_DAY    = "02"
	TIME_FMT_STR_HOUR   = "15"
	TIME_FMT_STR_MINUTE = "04"
	TIME_FMT_STR_SECOND = "05"
)

Variables

This section is empty.

Functions

func AppendBytes

func AppendBytes(b []byte, elems ...[]byte) []byte

func FileExist added in v1.0.1

func FileExist(path string) bool

func FreeAsyncLogRoutine

func FreeAsyncLogRoutine()

func FreeBuffers

func FreeBuffers()

func InitAsyncLogRoutine

func InitAsyncLogRoutine(msgQueueLen int)

must be called first

func InitBufferAutoFlushRoutine

func InitBufferAutoFlushRoutine(maxBufNum int, timeInterval time.Duration)

must be called first

func NewAsyncLogger

func NewAsyncLogger(logger ILogger) *asyncLogger

func NewBuffer

func NewBuffer(w IWriter, bufsize int) *buffer

func NewSimpleFormater

func NewSimpleFormater() *simpleFormater

func NewSimpleLogger

func NewSimpleLogger(writer IWriter, globalLevel int, formater IFormater) (*simpleLogger, error)

func NewWebFormater

func NewWebFormater(logId, ip []byte) *webFormater

func TimeGeneralLayout

func TimeGeneralLayout() string

Types

type ConsoleWriter added in v1.1.0

type ConsoleWriter struct {
	*os.File
	// contains filtered or unexported fields
}

func NewStderrWriter added in v1.1.0

func NewStderrWriter() *ConsoleWriter

func NewStdoutWriter added in v1.1.0

func NewStdoutWriter() *ConsoleWriter

func (*ConsoleWriter) Flush added in v1.1.0

func (this *ConsoleWriter) Flush() error

func (*ConsoleWriter) Free added in v1.1.0

func (this *ConsoleWriter) Free()

func (*ConsoleWriter) Write added in v1.1.0

func (this *ConsoleWriter) Write(msg []byte) (int, error)

type FileWithSplitWriter

type FileWithSplitWriter struct {
	*FileWriter
	// contains filtered or unexported fields
}

func NewFileWriterWithSplit

func NewFileWriterWithSplit(path string, split int) (*FileWithSplitWriter, error)

func (*FileWithSplitWriter) Write

func (this *FileWithSplitWriter) Write(msg []byte) (int, error)

type FileWriter

type FileWriter struct {
	*os.File
	// contains filtered or unexported fields
}

func NewFileWriter

func NewFileWriter(path string) (*FileWriter, error)

func (*FileWriter) CloseOnFree

func (this *FileWriter) CloseOnFree(closeOneFree bool) *FileWriter

func (*FileWriter) Flush

func (this *FileWriter) Flush() error

func (*FileWriter) Free

func (this *FileWriter) Free()

func (*FileWriter) Write

func (this *FileWriter) Write(msg []byte) (int, error)

type IFormater

type IFormater interface {
	Format(level int, msg []byte) []byte
}

type ILogger

type ILogger interface {
	Debug(msg []byte)
	Info(msg []byte)
	Notice(msg []byte)
	Warning(msg []byte)
	Error(msg []byte)
	Critical(msg []byte)
	Alert(msg []byte)
	Emergency(msg []byte)

	Log(level int, msg []byte) error

	Flush() error
	Free()
}

type IWriter

type IWriter interface {
	io.Writer

	Flush() error
	Free()
}

type NoopFormater

type NoopFormater struct {
}

func (*NoopFormater) Format

func (this *NoopFormater) Format(level int, msg []byte) []byte

type NoopLogger

type NoopLogger struct {
}

func (*NoopLogger) Alert

func (this *NoopLogger) Alert(msg []byte)

func (*NoopLogger) Critical

func (this *NoopLogger) Critical(msg []byte)

func (*NoopLogger) Debug

func (this *NoopLogger) Debug(msg []byte)

func (*NoopLogger) Emergency

func (this *NoopLogger) Emergency(msg []byte)

func (*NoopLogger) Error

func (this *NoopLogger) Error(msg []byte)

func (*NoopLogger) Flush

func (this *NoopLogger) Flush() error

func (*NoopLogger) Free

func (this *NoopLogger) Free()

func (*NoopLogger) Info

func (this *NoopLogger) Info(msg []byte)

func (*NoopLogger) Log

func (this *NoopLogger) Log(level int, msg []byte) error

func (*NoopLogger) Notice

func (this *NoopLogger) Notice(msg []byte)

func (*NoopLogger) Warning

func (this *NoopLogger) Warning(msg []byte)

type NoopWriter

type NoopWriter struct {
}

func (*NoopWriter) Flush

func (this *NoopWriter) Flush() error

func (*NoopWriter) Free

func (this *NoopWriter) Free()

func (*NoopWriter) Write

func (this *NoopWriter) Write(msg []byte) (int, error)

Jump to

Keyboard shortcuts

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