p36log

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

P36-Log-Go - Simple logging library for Go Copyright (C) 2019 Alexa Jones-Gonzales <alexa@partition36.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	SimpleErrorEnabled   = false
	SimpleWarningEnabled = false
	SimpleInfoEnabled    = false
	SimpleDebugEnabled   = false

	SimpleErrorHeader   = "Error"
	SimpleWarningHeader = "Warning"
	SimpleInfoHeader    = "Info"
	SimpleDebugHeader   = "Debug"

	SimpleErrorColor   = p36lib.FormatRedBold
	SimpleWarningColor = p36lib.FormatYellowBold
	SimpleInfoColor    = p36lib.FormatBlueBold
	SimpleDebugColor   = p36lib.FormatGreenBold
)

Functions

func SDebug

func SDebug(msg string, fmtArgs ...interface{})

func SError

func SError(msg string, fmtArgs ...interface{})

func SInfo

func SInfo(msg string, fmtArgs ...interface{})

func SWarn

func SWarn(msg string, fmtArgs ...interface{})

Types

type DefaultLogger

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

func (*DefaultLogger) DFLog

func (log *DefaultLogger) DFLog(msg string, fmtArgs ...interface{})

func (*DefaultLogger) DLog

func (log *DefaultLogger) DLog(minLevel LoggingLevel, msg string, fmtArgs ...interface{})

func (*DefaultLogger) ErrorLog

func (log *DefaultLogger) ErrorLog(msg string, fmtArgs ...interface{})

func (*DefaultLogger) Log

func (log *DefaultLogger) Log(msg string, fmtArgs ...interface{})

func (*DefaultLogger) SetDebugColor

func (log *DefaultLogger) SetDebugColor(newColor p36lib.FormatColor)

func (*DefaultLogger) SetDebugHeader

func (log *DefaultLogger) SetDebugHeader(newHeader string)

func (*DefaultLogger) SetDebugLevel

func (log *DefaultLogger) SetDebugLevel(newLevel LoggingLevel)

func (*DefaultLogger) SetDebugStream

func (log *DefaultLogger) SetDebugStream(newStream io.Writer)

func (*DefaultLogger) SetDefaultColor

func (log *DefaultLogger) SetDefaultColor(newColor p36lib.FormatColor)

func (*DefaultLogger) SetDefaultHeader

func (log *DefaultLogger) SetDefaultHeader(newHeader string)

func (*DefaultLogger) SetDefaultStream

func (log *DefaultLogger) SetDefaultStream(newStream io.Writer)

func (*DefaultLogger) SetErrorColor

func (log *DefaultLogger) SetErrorColor(newColor p36lib.FormatColor)

func (*DefaultLogger) SetErrorHeader

func (log *DefaultLogger) SetErrorHeader(newHeader string)

func (*DefaultLogger) SetErrorStream

func (log *DefaultLogger) SetErrorStream(newStream io.Writer)

func (*DefaultLogger) SetVerbosity

func (log *DefaultLogger) SetVerbosity(newLevel LoggingLevel)

func (*DefaultLogger) SetWarnColor

func (log *DefaultLogger) SetWarnColor(newColor p36lib.FormatColor)

func (*DefaultLogger) SetWarnHeader

func (log *DefaultLogger) SetWarnHeader(newHeader string)

func (*DefaultLogger) SetWarnStream

func (log *DefaultLogger) SetWarnStream(newStream io.Writer)

func (*DefaultLogger) VLog

func (log *DefaultLogger) VLog(minLevel LoggingLevel, msg string, fmtArgs ...interface{})

func (*DefaultLogger) WarnLog

func (log *DefaultLogger) WarnLog(msg string, fmtArgs ...interface{})

type Logger

type Logger interface {
	Log(msg string, fmtArgs ...interface{})
	VLog(minLevel LoggingLevel, msg string, fmtArgs ...interface{})
	DLog(minLevel LoggingLevel, msg string, fmtArgs ...interface{})
	DFLog(msg string, fmtArgs ...interface{})
	WarnLog(msg string, fmtArgs ...interface{})
	ErrorLog(msg string, fmtArgs ...interface{})

	SetVerbosity(newLevel LoggingLevel)
	SetDebugLevel(newLevel LoggingLevel)

	SetDefaultHeader(newHeader string)
	SetDebugHeader(newHeader string)
	SetWarnHeader(newHeader string)
	SetErrorHeader(newHeader string)

	SetDefaultColor(newColor p36lib.FormatColor)
	SetDebugColor(newColor p36lib.FormatColor)
	SetWarnColor(newColor p36lib.FormatColor)
	SetErrorColor(newColor p36lib.FormatColor)

	SetDefaultStream(newStream io.Writer)
	SetDebugStream(newStream io.Writer)
	SetWarnStream(newStream io.Writer)
	SetErrorStream(newStream io.Writer)
}

func NewDefaultLogger

func NewDefaultLogger() Logger

func NewNullLogger

func NewNullLogger() Logger

type LoggingLevel

type LoggingLevel uint8

type NullLogger

type NullLogger struct {
}

A NullLogger is an implementation of p36log.Logger that never outputs anything and stores nothing. Thus all method calls on it are effectively non-ops.

func (*NullLogger) DFLog

func (log *NullLogger) DFLog(msg string, fmtArgs ...interface{})

func (*NullLogger) DLog

func (log *NullLogger) DLog(minLevel LoggingLevel, msg string, fmtArgs ...interface{})

func (*NullLogger) ErrorLog

func (log *NullLogger) ErrorLog(msg string, fmtArgs ...interface{})

func (*NullLogger) Log

func (log *NullLogger) Log(msg string, fmtArgs ...interface{})

func (*NullLogger) SetDebugColor

func (log *NullLogger) SetDebugColor(newColor p36lib.FormatColor)

func (*NullLogger) SetDebugHeader

func (log *NullLogger) SetDebugHeader(newHeader string)

func (*NullLogger) SetDebugLevel

func (log *NullLogger) SetDebugLevel(newLevel LoggingLevel)

func (*NullLogger) SetDebugStream

func (log *NullLogger) SetDebugStream(newStream io.Writer)

func (*NullLogger) SetDefaultColor

func (log *NullLogger) SetDefaultColor(newColor p36lib.FormatColor)

func (*NullLogger) SetDefaultHeader

func (log *NullLogger) SetDefaultHeader(newHeader string)

func (*NullLogger) SetDefaultStream

func (log *NullLogger) SetDefaultStream(newStream io.Writer)

func (*NullLogger) SetErrorColor

func (log *NullLogger) SetErrorColor(newColor p36lib.FormatColor)

func (*NullLogger) SetErrorHeader

func (log *NullLogger) SetErrorHeader(newHeader string)

func (*NullLogger) SetErrorStream

func (log *NullLogger) SetErrorStream(newStream io.Writer)

func (*NullLogger) SetVerbosity

func (log *NullLogger) SetVerbosity(newLevel LoggingLevel)

func (*NullLogger) SetWarnColor

func (log *NullLogger) SetWarnColor(newColor p36lib.FormatColor)

func (*NullLogger) SetWarnHeader

func (log *NullLogger) SetWarnHeader(newHeader string)

func (*NullLogger) SetWarnStream

func (log *NullLogger) SetWarnStream(newStream io.Writer)

func (*NullLogger) VLog

func (log *NullLogger) VLog(minLevel LoggingLevel, msg string, fmtArgs ...interface{})

func (*NullLogger) WarnLog

func (log *NullLogger) WarnLog(msg string, fmtArgs ...interface{})

Jump to

Keyboard shortcuts

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