logs

package
v0.0.0-...-837aff2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseConfiguration

func DatabaseConfiguration() *sql.DB

DatabaseConfiguration - sets up the DB connection

func NewSysLogger

func NewSysLogger(prio syslog.Priority, flag int) (*log.Logger, error)

NewSysLogger creates a new system logger (SysLogger)

Types

type CompositeLog

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

CompositeLog structure was needed to implement the "true for debug, false for no debug" functionality.

func NewCustomLogger

func NewCustomLogger(flag bool, args ...SuperLogger) *CompositeLog

NewCustomLogger adds all passed loggers into a slice of SuperLoggers (Variadic args...SuperLogger) We see here that we can add more loggers (we just need to pass them through)

func (*CompositeLog) Debug

func (composite *CompositeLog) Debug(v ...interface{})

Debug (skipped if flag == false)

func (*CompositeLog) Debugf

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

Debugf (skipped if flag == false)

func (*CompositeLog) Error

func (composite *CompositeLog) Error(v ...interface{})

Error ..

func (*CompositeLog) Errorf

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

Errorf ..

func (*CompositeLog) Info

func (composite *CompositeLog) Info(v ...interface{})

Info ..

func (*CompositeLog) Infof

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

Infof ..

func (*CompositeLog) Warn

func (composite *CompositeLog) Warn(v ...interface{})

Warn ..

func (*CompositeLog) Warnf

func (composite *CompositeLog) Warnf(format string, v ...interface{})

Warnf ..

type DBLogger

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

DBLogger subclass

func NewDBLogger

func NewDBLogger(db *sql.DB) *DBLogger

NewDBLogger routes the DB connection from "DatabaseConfiguration" to the DB logger, then creates it.

func (*DBLogger) Close

func (dblog *DBLogger) Close()

Close closes the DB connection

func (*DBLogger) Printf

func (dblog *DBLogger) Printf(format string, v ...interface{})

Printf (for DB) converts the printed output to string, then passes it for database recording

func (*DBLogger) Println

func (dblog *DBLogger) Println(v ...interface{})

Println (for DB) converts the printed output to string, then passes it for database recording

func (*DBLogger) SetPrefix

func (dblog *DBLogger) SetPrefix(s string)

SetPrefix for DB

func (*DBLogger) ToDB

func (dblog *DBLogger) ToDB(str string)

ToDB writes to database

type FileLogger

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

FileLogger subclass

func NewFileLogger

func NewFileLogger(path string) *FileLogger

NewFileLogger creates a new file logger (attaches the opened/created file found at "path" to the file loggers' file descriptor)

func (*FileLogger) Close

func (flogger *FileLogger) Close()

Close closes the IO for the logger

func (*FileLogger) Printf

func (flogger *FileLogger) Printf(format string, v ...interface{})

Printf directly uses the file descriptors' Write()

func (*FileLogger) Println

func (flogger *FileLogger) Println(v ...interface{})

Println directly uses the file descriptors' Write()

func (*FileLogger) SetPrefix

func (flogger *FileLogger) SetPrefix(s string)

SetPrefix sets the prefix of the logger

type StdLogger

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

StdLogger subclass

func NewStdLogger

func NewStdLogger() *StdLogger

NewStdLogger creates a new stdout logger (StdLogger) by attaching the opened /dev/stdout to the file descriptor.

func (*StdLogger) Close

func (stdlogger *StdLogger) Close()

Close closes the IO for the logger

func (*StdLogger) Printf

func (stdlogger *StdLogger) Printf(format string, v ...interface{})

Printf directly uses the file descriptors' Write()

func (*StdLogger) Println

func (stdlogger *StdLogger) Println(v ...interface{})

Println directly uses the file descriptors' Write()

func (*StdLogger) SetPrefix

func (stdlogger *StdLogger) SetPrefix(s string)

SetPrefix sets the prefix of the logger

type SuperLogger

type SuperLogger interface {
	Println(v ...interface{})
	Printf(format string, v ...interface{})
	SetPrefix(s string)
}

SuperLogger superclass

type SysLogger

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

SysLogger subclass

func (*SysLogger) Printf

func (syslogger *SysLogger) Printf(format string, v ...interface{})

Printf wraps the Printf function of the logger

func (*SysLogger) Println

func (syslogger *SysLogger) Println(v ...interface{})

Println wraps the Println function of the logger

func (*SysLogger) SetPrefix

func (syslogger *SysLogger) SetPrefix(s string)

SetPrefix wraps the SetPrefix function of the logger

Jump to

Keyboard shortcuts

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