Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 5 Imported by: 0

README

log

a package for Log structure.

Log

type Log struct {
	Message string
	Level   loglevel.LogLevel
	Time    time.Time
}

Log has Message, Level, and Time members.
loglevel is a package for log level.

LogFactory

type LogFactory struct {
	Time    time.Time
	Message strings.Builder
	Level   loglevel.LogLevel

	hasParam bool
}

Log is made by LogFactory.

New

func New(level loglevel.LogLevel, message string) *LogFactory

New constructor return LogFactory instance with level and message.

AddParam

func (l *LogFactory) AddParamString(key string, value string) *LogFactory

func (l *LogFactory) AddParamInt(key string, value int) *LogFactory

func (l *LogFactory) AddParamUint(key string, value uint) *LogFactory

func (l *LogFactory) AddParamBool(key string, value bool) *LogFactory

func (l *LogFactory) AddParamFloat(key string, value float64) *LogFactory

func (l *LogFactory) AddParamComplex(key string, value complex128) *LogFactory

LogFactory can receive some primitive type parameters.
this methods concatenate key and value to message and return LogFactory instance.

End

func (l *LogFactory) End() Log

finally, End method returns Log instance.

Compare

func (l Log) Compare(other queue.Item) int

Compare is implementation of Comparable interface.
if l.Time is earlier than other.Time, return -1.
if l.Time is later than other.Time, return 1.
else, return 0.

Interface

Writable

type Writable interface {
	Write(log Log) error
	Close() error
}

Writable is interface for writing log.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	Message string
	Level   loglevel.LogLevel
	Time    time.Time
}

func (Log) Compare

func (l Log) Compare(other queue.Item) int

type LogFactory

type LogFactory struct {
	Time    time.Time
	Message strings.Builder
	Level   loglevel.LogLevel
	// contains filtered or unexported fields
}

func New

func New(level loglevel.LogLevel, message string) *LogFactory

func (*LogFactory) AddParamBool

func (l *LogFactory) AddParamBool(key string, value bool) *LogFactory

func (*LogFactory) AddParamComplex

func (l *LogFactory) AddParamComplex(key string, value complex128) *LogFactory

func (*LogFactory) AddParamFloat

func (l *LogFactory) AddParamFloat(key string, value float64) *LogFactory

func (*LogFactory) AddParamInt

func (l *LogFactory) AddParamInt(key string, value int) *LogFactory

func (*LogFactory) AddParamString

func (l *LogFactory) AddParamString(key string, value string) *LogFactory

func (*LogFactory) AddParamUint

func (l *LogFactory) AddParamUint(key string, value uint) *LogFactory

func (*LogFactory) End

func (l *LogFactory) End() Log

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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