log

package
v0.0.0-...-a578f59 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2013 bee authors

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DiscardNonColorEscSeq outputMode
	OutputNonColorEscSeq
)

DiscardNonColorEscSeq supports the divided color escape sequence. But non-color escape sequence is not output. Please use the OutputNonColorEscSeq If you want to output a non-color escape sequences such as ncurses. However, it does not support the divided color escape sequence.

Variables

This section is empty.

Functions

func Black

func Black(message string) string

Black returns a black string

func BlackBold

func BlackBold(message string) string

BlackBold returns a black bold string

func Blue

func Blue(message string) string

Blue returns a blue string

func BlueBold

func BlueBold(message string) string

BlueBold returns a blue bold string

func Bold

func Bold(message string) string

Bold returns a blod string

func Cyan

func Cyan(message string) string

Cyan returns a cyan string

func CyanBold

func CyanBold(message string) string

CyanBold returns a cyan bold string

func EndLine

func EndLine() string

EndLine returns the a newline escape character

func Gray

func Gray(message string) string

Gray returns a gray string

func GrayBold

func GrayBold(message string) string

GrayBold returns a gray bold string

func Green

func Green(message string) string

Green returns a green string

func GreenBold

func GreenBold(message string) string

GreenBold returns a green bold string

func IsDebugEnabled

func IsDebugEnabled() bool

IsDebugEnabled checks if DEBUG_ENABLED is set or not

func Magenta

func Magenta(message string) string

Magenta returns a magenta string

func MagentaBold

func MagentaBold(message string) string

MagentaBold returns a magenta bold string

func MustCheck

func MustCheck(err error)

MustCheck panics when the error is not nil

func NewColorWriter

func NewColorWriter(w io.Writer) io.Writer

NewColorWriter creates and initializes a new ansiColorWriter using io.Writer w as its initial contents. In the console of Windows, which change the foreground and background colors of the text by the escape sequence. In the console of other systems, which writes to w all text.

func NewModeColorWriter

func NewModeColorWriter(w io.Writer, mode outputMode) io.Writer

NewModeColorWriter create and initializes a new ansiColorWriter by specifying the outputMode.

func Now

func Now(layout string) string

Now returns the current local time in the specified layout

func Red

func Red(message string) string

Red returns a red string

func RedBold

func RedBold(message string) string

RedBold returns a red bold string

func White

func White(message string) string

White returns a white string

func WhiteBold

func WhiteBold(message string) string

WhiteBold returns a white bold string

func Yellow

func Yellow(message string) string

Yellow returns a yellow string

func YellowBold

func YellowBold(message string) string

YellowBold returns a yellow bold string

Types

type EgoLogger

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

EgoLogger logs logging records to the specified io.Writer

func GetEgoLogger

func GetEgoLogger(w io.Writer) *EgoLogger

GetEgoLogger initializes the logger instance with a NewColorWriter output and returns a singleton

func (*EgoLogger) Critical

func (l *EgoLogger) Critical(message string)

Critical outputs a critical log message

func (*EgoLogger) Criticalf

func (l *EgoLogger) Criticalf(message string, vars ...interface{})

Criticalf outputs a formatted critical log message

func (*EgoLogger) Debug

func (l *EgoLogger) Debug(message string, file string, line int)

Debug outputs a debug log message

func (*EgoLogger) Debugf

func (l *EgoLogger) Debugf(message string, file string, line int, vars ...interface{})

Debugf outputs a formatted debug log message

func (*EgoLogger) Error

func (l *EgoLogger) Error(message string)

Error outputs an error log message

func (*EgoLogger) Errorf

func (l *EgoLogger) Errorf(message string, vars ...interface{})

Errorf outputs a formatted error log message

func (*EgoLogger) Fatal

func (l *EgoLogger) Fatal(message string)

Fatal outputs a fatal log message and exists

func (*EgoLogger) Fatalf

func (l *EgoLogger) Fatalf(message string, vars ...interface{})

Fatalf outputs a formatted log message and exists

func (*EgoLogger) Hint

func (l *EgoLogger) Hint(message string)

Hint outputs a hint log message

func (*EgoLogger) Hintf

func (l *EgoLogger) Hintf(message string, vars ...interface{})

Hintf outputs a formatted hint log message

func (*EgoLogger) Info

func (l *EgoLogger) Info(message string)

Info outputs an information log message

func (*EgoLogger) Infof

func (l *EgoLogger) Infof(message string, vars ...interface{})

Infof outputs a formatted information log message

func (*EgoLogger) SetOutput

func (l *EgoLogger) SetOutput(w io.Writer)

SetOutput sets the logger output destination

func (*EgoLogger) Success

func (l *EgoLogger) Success(message string)

Success outputs a success log message

func (*EgoLogger) Successf

func (l *EgoLogger) Successf(message string, vars ...interface{})

Successf outputs a formatted success log message

func (*EgoLogger) Warn

func (l *EgoLogger) Warn(message string)

Warn outputs a warning log message

func (*EgoLogger) Warnf

func (l *EgoLogger) Warnf(message string, vars ...interface{})

Warnf outputs a formatted warning log message

type LogRecord

type LogRecord struct {
	ID       string
	Level    string
	Message  string
	Filename string
	LineNo   int
}

LogRecord represents a log record and contains the timestamp when the record was created, an increasing id, level and the actual formatted log line.

Jump to

Keyboard shortcuts

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