logger

package
v0.0.0-...-3de6311 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelInfo is something notable infomation.
	LevelInfo int = iota
	// LevelWarn is warning.
	LevelWarn
	// LevelError is unexpected runtime error.
	LevelError
	// LevelFatal is an abend error.
	LevelFatal
	// LevelTextInfo is the text for info.
	LevelTextInfo = "info"
	// LevelTextWarn is the text for warn.
	LevelTextWarn = "warn"
	// LevelTextError is the text for error.
	LevelTextError = "error"
	// LevelTextFatal is the text for fatal.
	LevelTextFatal = "fatal"
	// LabelBalance is a label for balance.
	LabelBalance = "[Balance]"
	// LabelBalanceHistory is a label for balance history.
	LabelBalanceHistory = "[Balance History]"
	// LabelChat is a label for chat.
	LabelChat = "[Chat]"
	// LabelChildOrder is a label for child order.
	LabelChildOrder = "[ChildOrder]"
	// LabelCollateral is a label for collateral.
	LabelCollateral = "[Collateral]"
	// LabelExecution is a label for execution.
	LabelExecution = "[Execution]"
	// LabelPosition is a label for position.
	LabelPosition = "[Position]"
	// LabelTicker is a label for Ticker.
	LabelTicker = "[Ticker]"
	// LabelTradingCommission is a label for trading commission.
	LabelTradingCommission = "[Trading Commission]"
)

Variables

This section is empty.

Functions

func LevelText

func LevelText(level int) string

LevelText returns the text of level.

Types

type AccessLogEntry

type AccessLogEntry struct {
	Level  string    `json:"level"`
	Time   time.Time `json:"time"` // UTC
	Method string    `json:"method"`
	URL    string    `json:"url"`
	Body   string    `json:"body"`
}

An AccessLogEntry represents an entry for access log.

type Entry

type Entry struct {
	Level   string    `json:"level"`
	Time    time.Time `json:"time"` // UTC
	Message string    `json:"message"`
}

An Entry represents an entry for basic log.

type Fields

type Fields map[string]interface{}

Fields is a fields

type Logger

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

A Logger represents a logger.

func NewLogger

func NewLogger(threshold int, location *time.Location) *Logger

NewLogger creates a logger.

func (*Logger) Error

func (l *Logger) Error(entry interface{})

Error outputs a error level log.

func (*Logger) Fatal

func (l *Logger) Fatal(entry interface{})

Fatal outputs a fatal level log.

func (*Logger) Info

func (l *Logger) Info(entry interface{})

Info outputs a info level log.

func (*Logger) OutputJSON

func (l *Logger) OutputJSON(level string, entry interface{}) error

OutputJSON outputs logs.

func (*Logger) Warn

func (l *Logger) Warn(entry interface{})

Warn outputs a warn level log.

type TradingLogEntry

type TradingLogEntry struct {
	Level  string    `json:"level"`
	Time   time.Time `json:"time"` // UTC
	Label  string    `json:"label"`
	Action string    `json:"action"`
}

A TradingLogEntry represents an entry for trading log.

Jump to

Keyboard shortcuts

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