log

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package log provides logging support for the application and framework developers

Index

Constants

View Source
const DebugLog = 10 // Debug log for the developer's application, separate from the goradd framework debug log
View Source
const ErrorLog = 4 // Should be sent to sysop immediately
View Source
const FrameworkDebugLog = 1 // Should only exist when debugging style logs are required for debugging the goradd framework itself.
View Source
const InfoLog = 2 // Info log is designed to always exist. These would be messages we only need to check periodically to know the system is working correctly.
View Source
const WarningLog = 3 // Should be sent to sysop periodically (daily perhaps?). Would generally be issues involving low resources.

Variables

View Source
var Loggers = map[int]LoggerI{}

Loggers is the global map of loggers in use.

Functions

func CreateDefaultLoggers

func CreateDefaultLoggers()

CreateDefaultLoggers create's default loggers for the application. After calling this, you can replace the loggers with your own, and add additional loggers to the logging array, or remove ones you don't use.

func Debug

func Debug(v ...interface{})

Debug is for application debugging logging. It becomes a no-op in the release build.

func Debugf

func Debugf(format string, v ...interface{})

Debugf prints formatted information to the application Debug logger. It becomes a no-op in the release build.

func Error

func Error(v ...interface{})

Error prints to the Error logger.

func Errorf

func Errorf(format string, v ...interface{})

Error prints formmated information to the Error logger.

func FrameworkDebug

func FrameworkDebug(v ...interface{})

FrameworkDebug is used by the framework to log debugging information. This is mostly for development of the framework, but it can also be used to track down problems in your own code. It becomes a no-op in the release build.

func FrameworkDebugf

func FrameworkDebugf(format string, v ...interface{})

FrameworkDebugf is used by the framework to log formatted debugging information. It becomes a no-op in the release build.

func HasLogger

func HasLogger(id int) bool

HasLogger returns true if the given logger is available.

func Info

func Info(v ...interface{})

Info prints information to the Info logger.

func Infof

func Infof(format string, v ...interface{})

Infof prints formatted information to the Info logger.

func Print

func Print(logType int, v ...interface{})

Print prints information to the given logger. You can use this to set up your own custom logger.

func Printf

func Printf(logType int, format string, v ...interface{})

Printf prints formatted information to the given logger.

func SetLogger added in v0.0.3

func SetLogger(id int, l LoggerI)

func Warning

func Warning(v ...interface{})

Warning prints to the Warning logger.

func Warningf

func Warningf(format string, v ...interface{})

Warningf prints formatted information to the Warning logger.

Types

type EmailLogger

type EmailLogger struct {
	StandardLogger
	EmailAddresses []string
}

EmailLogger is a logger that will email logging activity to the emails provided.

func (EmailLogger) Log

func (l EmailLogger) Log(out string)

type LoggerI

type LoggerI interface {
	Log(err string)
}

LoggerI is the interface for all loggers.

type StandardLogger

type StandardLogger struct {
	*log.Logger
}

StandardLogger reuses the GO default logger

func (StandardLogger) Log

func (l StandardLogger) Log(out string)

Jump to

Keyboard shortcuts

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