cblog

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 14 Imported by: 13

Documentation

Index

Constants

View Source
const (
	Black = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Console added in v0.0.6

type Console struct {
	// contains filtered or unexported fields
}

func NewConsole added in v0.0.6

func NewConsole(replace, limit, progress bool) *Console

func (*Console) AutoPrint added in v0.0.8

func (c *Console) AutoPrint()

func (*Console) Finish added in v0.0.6

func (c *Console) Finish(printStats bool, extraMessage ...interface{})

func (*Console) NewLine added in v0.0.6

func (c *Console) NewLine()

func (*Console) Print added in v0.0.6

func (c *Console) Print(message string, args ...interface{})

func (*Console) Println added in v0.0.6

func (c *Console) Println(message string, args ...interface{})

func (*Console) SetPrintFunc added in v0.0.8

func (c *Console) SetPrintFunc(print func() string)

func (*Console) SetWriter added in v0.0.6

func (c *Console) SetWriter(writer io.Writer)

func (*Console) Start added in v0.0.6

func (c *Console) Start(prefix string)

func (*Console) Tick added in v0.0.8

func (c *Console) Tick()

type LogLevel

type LogLevel int
const (
	CriticalLevel LogLevel = iota + 1
	ErrorLevel
	WarningLevel
	NoticeLevel
	InfoLevel
	DebugLevel
)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(config LoggerConfig) (*Logger, error)

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) CriticalF

func (l *Logger) CriticalF(category, format string, a ...interface{})

func (*Logger) DebugF

func (l *Logger) DebugF(category, format string, a ...interface{})

func (*Logger) ErrorF

func (l *Logger) ErrorF(category, format string, a ...interface{})

func (*Logger) FatalF

func (l *Logger) FatalF(category, format string, a ...interface{})

func (*Logger) GetStackTraceOffset added in v0.0.2

func (l *Logger) GetStackTraceOffset() int

func (*Logger) InfoF

func (l *Logger) InfoF(category, format string, a ...interface{})

func (*Logger) NoticeF

func (l *Logger) NoticeF(category, format string, a ...interface{})

func (*Logger) PanicF

func (l *Logger) PanicF(category, format string, a ...interface{})

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

func (*Logger) SetStackTraceOffset added in v0.0.2

func (l *Logger) SetStackTraceOffset(offset int)

func (*Logger) Stack added in v0.0.4

func (l *Logger) Stack() string

func (*Logger) StackAsCritical

func (l *Logger) StackAsCritical(category, message string)

func (*Logger) StackAsError

func (l *Logger) StackAsError(category, message string)

func (*Logger) WarningF

func (l *Logger) WarningF(category, format string, a ...interface{})

func (*Logger) Write

func (l *Logger) Write(bytes []byte) (int, error)

type LoggerConfig

type LoggerConfig struct {
	LogLevel                LogLevel
	Format                  string // placeholders: %{id}, %{time[:fmt]}, %{module}, %{filename}, %{line}, %{level}, %{message}, %{category}
	LogToFile               bool
	FilePath                string
	FilePerm                os.FileMode
	LogToStdOut             bool
	StdOutColor             int
	LogToUnixSocket         bool
	UnixSocketPath          string
	AdditionalWriters       []io.Writer
	AdditionalWriterClosers []io.WriteCloser
	SetAsDefaultLogger      bool
}

func DefaultLoggerConfig

func DefaultLoggerConfig() LoggerConfig

type MultipleWriter

type MultipleWriter struct {
	// contains filtered or unexported fields
}

func NewMultipleWriter

func NewMultipleWriter(writers ...io.Writer) MultipleWriter

func (MultipleWriter) Write

func (m MultipleWriter) Write(p []byte) (n int, err error)

type UnixSocketLogger

type UnixSocketLogger struct {
	// contains filtered or unexported fields
}

func NewUnixSockerLogger

func NewUnixSockerLogger(path string) *UnixSocketLogger

func (*UnixSocketLogger) Write

func (u *UnixSocketLogger) Write(message []byte) (n int, err error)

Jump to

Keyboard shortcuts

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