Categorygithub.com/canhlinh/log4go
modulepackage
0.0.0-20171123040613-fb8d218825e0
Repository: https://github.com/canhlinh/log4go.git
Documentation: pkg.go.dev

# README

Log for golang, goji log, gorm log, echo log

Installation:

go get github.com/canhlinh/log4go

Usage:

  • Add the following import:
import log "github.com/canhlinh/log4go"

Example

package main

import (
	"time"
)

import log "github.com/canhlinh/log4go"

func main() {
	defer log.Close()
	log.AddFilter("stdout", log.DEBUG, log.NewConsoleLogWriter())
	log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Debug("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Warn("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Error("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
	log.Trace("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
}

# Packages

No description provided by the author

# Functions

Wrapper for (*Logger).AddFilter.
Wrapper for (*Logger).Close (closes and removes all logwriters).
No description provided by the author
Logs the given message and crashes the program.
Utility for critical log messages (returns an error for easy function returns) (see Debug() for parameter explanation) These functions will execute a closure exactly once, to build the error message for the return Wrapper for (*Logger).Critical.
Utility for debug log messages When given a string as the first argument, this behaves like Logf but with the DEBUG log level (e.g.
Utility for error log messages (returns an error for easy function returns) (see Debug() for parameter explanation) These functions will execute a closure exactly once, to build the error message for the return Wrapper for (*Logger).Error.
Compatibility with `log`.
Compatibility with `log`.
Utility for fine log messages (see Debug() for parameter explanation) Wrapper for (*Logger).Fine.
Utility for finest log messages (see Debug() for parameter explanation) Wrapper for (*Logger).Finest.
Known format codes: %T - Time (15:04:05 MST) %t - Time (15:04) %D - Date (2006/01/02) %d - Date (01/02/06) %L - Level (FNST, FINE, DEBG, TRAC, WARN, EROR, CRIT) %S - Source %M - Message Ignores unknown formats Recommended: "[%D %T] [%L] (%S) %M".
Utility for info log messages (see Debug() for parameter explanation) Wrapper for (*Logger).Info.
Wrapper for (*Logger).LoadConfiguration.
Send a log message manually Wrapper for (*Logger).Log.
Send a closure log message Wrapper for (*Logger).Logc.
Send a formatted log message easily Wrapper for (*Logger).Logf.
Migration support only for Migration ouput.
Create a new logger with a "stdout" filter configured to send log messages at or above lvl to standard output.
This creates a new ConsoleLogWriter.
Create a new logger with a "stdout" filter configured to send log messages at or above lvl to standard output.
No description provided by the author
NewFileLogWriter creates a new LogWriter which writes to the given file and has rotation enabled if rotate is true.
This creates a new FormatLogWriter.
No description provided by the author
No description provided by the author
Create a new logger.
NewSentryLogWriter This creates a new SentryLogWriter.
No description provided by the author
NewXMLLogWriter is a utility method for creating a FileLogWriter set up to output XML record log messages instead of line-based ones.
No description provided by the author
Compatibility with `log`.
Compatibility with `log`.
Compatibility with `log`.
Compatibility with `log`.
Utility for trace log messages (see Debug() for parameter explanation) Wrapper for (*Logger).Trace.
Utility for warn log messages (returns an error for easy function returns) (see Debug() for parameter explanation) These functions will execute a closure exactly once, to build the error message for the return Wrapper for (*Logger).Warn.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Version information.
Version information.
Version information.
Version information.
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
LogBufferLength specifies how many log messages a particular log4go logger can buffer at a time before writing them.
No description provided by the author

# Structs

This is the standard writer that prints to standard output.
This log writer sends output to a file.
A Filter represents the log level below which no log records are written to the associated LogWriter.
No description provided by the author
A LogRecord contains all of the pertinent information for each message.
SentryLogWriter This is the standard writer that prints to standard output.
No description provided by the author

# Interfaces

This is an interface for anything that should be able to write logs.

# Type aliases

These are the integer logging levels used by the logger.
A Logger represents a collection of Filters through which log messages are written.