Documentation
¶
Index ¶
- type FileRotationOptions
- type IOutput
- func Console(maxLevel level.Level, processors ...processor.IProcessor) IOutput
- func File(path string, maxLevel level.Level, processors ...processor.IProcessor) IOutput
- func FileBased(name string, maxLevel level.Level, writer io.Writer, ...) IOutput
- func FileWithRotation(path string, maxLevel level.Level, options *FileRotationOptions, ...) IOutput
- func New(name string, maxLevel level.Level, w io.Writer, ...) IOutput
- func SafeBuffer(maxLevel level.Level, processors ...processor.IProcessor) (*safebuffer.Buffer, IOutput)
- func StdErr(processors ...processor.IProcessor) IOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileRotationOptions ¶
type FileRotationOptions lumberjack.Logger
FileRotationOptions for the log file.
type IOutput ¶
type IOutput interface {
meta.IMeta
// String interface.
String() string
// GetBuiltinLogger returns the Golang's builtin logger.
GetBuiltinLogger() *builtin.Builtin
// SetBuiltinLogger sets the Golang's builtin logger.
// TODO: SetXYZ should return IOutput.
SetBuiltinLogger(builtinLogger *builtin.Builtin)
// GetFormatter returns the formatter.
GetFormatter() formatter.IFormatter
// SetFormatter sets the formatter.
SetFormatter(fmtr formatter.IFormatter) IOutput
// GetMaxLevel returns the max level.
GetMaxLevel() level.Level
// SetMaxLevel sets the max level.
SetMaxLevel(l level.Level)
// AddProcessors adds one or more processors.
AddProcessors(processors ...processor.IProcessor) IOutput
// GetProcessor returns the registered processor by its name. If not found, will be nil.
GetProcessor(name string) processor.IProcessor
// SetProcessors sets one or more processors.
SetProcessors(processors ...processor.IProcessor)
// GetProcessors returns registered processors.
GetProcessors() []processor.IProcessor
// GetProcessorsNames returns the names of the registered processors.
GetProcessorsNames() []string
// GetWriter returns the writer.
GetWriter() io.Writer
// SetWriter sets the writer.
SetWriter(w io.Writer)
// Write write the message to the defined output.
Write(m message.IMessage) error
}
IProcessor specifies what an output does.
func Console ¶
func Console(maxLevel level.Level, processors ...processor.IProcessor) IOutput
Console is a built-in `output` - named `Console`, that writes to `stdout`.
func File ¶
File is a built-in `output` - named `File`, that writes to the specified file.
Note: If the common used "-" is used, it will behave as a Console writing to stdout, and named "-".
func FileBased ¶
func FileBased( name string, maxLevel level.Level, writer io.Writer, processors ...processor.IProcessor, ) IOutput
FileBased is a built-in `output`, that writes to the specified file. TODO: Remove `path`.
func FileWithRotation ¶
func FileWithRotation( path string, maxLevel level.Level, options *FileRotationOptions, processors ...processor.IProcessor, ) IOutput
FileWithRotation is a built-in `output` - named `FileWithRotation`, that writes to the specified file, an is automatically rotated.
Note: If the common used "-" is used, it will behave as a Console writing to stdout, and named "-".
func New ¶ added in v1.4.0
func New(name string, maxLevel level.Level, w io.Writer, processors ...processor.IProcessor, ) IOutput
New is the Output factory.
func SafeBuffer ¶
func SafeBuffer(maxLevel level.Level, processors ...processor.IProcessor) (*safebuffer.Buffer, IOutput)
SafeBuffer is a built-in `output` - named `Buffer`, that writes to the buffer.
func StdErr ¶ added in v1.3.4
func StdErr(processors ...processor.IProcessor) IOutput
StdErr is a built-in `output` - named `StdErr`, that only writes to `stderr` message @ Error level.