package
1.12.5-sonek
Repository: https://github.com/openstars/beego.git
Documentation: pkg.go.dev

# README

logs

logs is a Go logs manager. It can use many logs adapters. The repo is inspired by database/sql .

How to install?

go get github.com/OpenStars/beego/logs

What adapters are supported?

As of now this logs support console, file,smtp and conn.

How to use it?

First you must import it

import (
	"github.com/OpenStars/beego/logs"
)

Then init a Log (example with console adapter)

log := logs.NewLogger(10000)
log.SetLogger("console", "")

the first params stand for how many channel

Use it like this:

log.Trace("trace")
log.Info("info")
log.Warn("warning")
log.Debug("debug")
log.Critical("critical")

File adapter

Configure file adapter like this:

log := NewLogger(10000)
log.SetLogger("file", `{"filename":"test.log"}`)

Conn adapter

Configure like this:

log := NewLogger(1000)
log.SetLogger("conn", `{"net":"tcp","addr":":7020"}`)
log.Info("info")

Smtp adapter

Configure like this:

log := NewLogger(10000)
log.SetLogger("smtp", `{"username":"[email protected]","password":"xxxxxxxx","host":"smtp.gmail.com:587","sendTos":["[email protected]"]}`)
log.Critical("sendmail critical")
time.Sleep(time.Second * 30)

# Packages

Package alils implements the SDK(v0.5.0) of Simple Log Service(abbr.
No description provided by the author

# Functions

AccessLog - Format and print access log.
Alert logs a message at alert level.
Async set the beelogger with Async mode and hold msglen messages.
ColorByMethod return color by http code.
ColorByStatus return color by http code 2xx return Green 3xx return White 4xx return Yellow 5xx return Red.
Critical logs a message at critical level.
Debug logs a message at debug level.
Emergency logs a message at emergency level.
EnableFuncCallDepth enable log funcCallDepth.
Error logs a message at error level.
GetBeeLogger returns the default BeeLogger.
GetLogger returns the default BeeLogger.
Info compatibility alias for Warning().
Informational logs a message at info level.
NewConn create new ConnWrite returning as LoggerInterface.
NewConsole create ConsoleWriter returning as LoggerInterface.
NewLogger returns a new BeeLogger.
Notice logs a message at notice level.
Register makes a log provide available by the provided name.
Reset will remove all the adapter.
ResetColor return reset color.
SetLevel sets the global log level used by the simple logger.
SetLogFuncCall set the CallDepth, default is 4.
SetLogFuncCallDepth set log funcCallDepth.
SetLogger sets a new logger.
SetPrefix sets the prefix.
Trace logs a message at trace level.
Warn compatibility alias for Warning().
Warning logs a message at warning level.

# Constants

Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
Name for adapter with beego official support.
RFC5424 log message levels.
RFC5424 log message levels.
RFC5424 log message levels.
RFC5424 log message levels.
RFC5424 log message levels.
Legacy log level constants to ensure backwards compatibility.
RFC5424 log message levels.
RFC5424 log message levels.
Legacy log level constants to ensure backwards compatibility.
Legacy log level constants to ensure backwards compatibility.
RFC5424 log message levels.

# Structs

AccessLogRecord struct for holding access log data.
BeeLogger is default logger in beego application.
JLWriter implements beego LoggerInterface and is used to send jiaoliao webhook.
SLACKWriter implements beego LoggerInterface and is used to send jiaoliao webhook.
SMTPWriter implements LoggerInterface and is used to send emails via given SMTP-server.

# Interfaces

Logger defines the behavior of a log provider.