log

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 6 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 log.Log

func New

func New(appID int32, level int32, msg string, param ...Param) Log

func (Log) Compare

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

type Param

type Param string

func Binary

func Binary(k string, v []byte) Param

func Bool

func Bool(k string, v bool) Param

func Byte

func Byte(k string, v byte) Param

func Duration

func Duration(k string, v time.Duration) Param

func Float32

func Float32(k string, v float32) Param

func Float64

func Float64(k string, v float64) Param

func Hex

func Hex(k string, v []byte) Param

func Int

func Int(k string, v int) Param

func Int16

func Int16(k string, v int16) Param

func Int32

func Int32(k string, v int32) Param

func Int64

func Int64(k string, v int64) Param

func Int8

func Int8(k string, v int8) Param

func Rune

func Rune(k string, v rune) Param

func String

func String(k string, v string) Param

func Uint

func Uint(k string, v uint) Param

func Uint16

func Uint16(k string, v uint16) Param

func Uint32

func Uint32(k string, v uint32) Param

func Uint64

func Uint64(k string, v uint64) Param

func Uint8

func Uint8(k string, v uint8) Param

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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