Documentation ¶
Index ¶
- Constants
- type Log
- func Critical(text string, err error) (log Log)
- func Criticalf(err error, format string, a ...interface{}) (log Log)
- func Debug(text string) (log Log)
- func Debugf(format string, a ...interface{}) (log Log)
- func Error(text string, err error) (log Log)
- func Errorf(err error, format string, a ...interface{}) (log Log)
- func Fatal(text string, err error) (log Log)
- func Fatalf(err error, format string, a ...interface{}) (log Log)
- func Info(text string) (log Log)
- func Infof(format string, a ...interface{}) (log Log)
- func Warning(text string, err error) (log Log)
- func Warningf(err error, format string, a ...interface{}) (log Log)
- func (log Log) Debug() Log
- func (log Log) Special(special string) Log
- func (log Log) Stack(stacktrace string) Log
- func (log Log) ToConsoleString() (logString string)
- func (log Log) ToString() (logString string)
- func (log Log) TypeToColorCode(Type int) (color string)
- func (log Log) TypeToString(Type int) (TypeString string)
- type Logger
- type SNSClient
- type Stream
Constants ¶
const ( // InfoSeverity is the severity for non-serious information InfoSeverity = iota // WarnSeverity is for concerning information that does not stop the flow of the application but is concerning WarnSeverity // ErrorSeverity is for events that prevent normal flow of the application ErrorSeverity // CritSeverity is for series issues that occur in the application CritSeverity // FatalSeverity is for serious events that occur during execution FatalSeverity // InfoDetail is used in logs to discern that it is informational InfoDetail = "INFO" // WarnDetail is used in logs to discern that it is a warning WarnDetail = "WARN" // ErrorDetail is used in logs to discern that it is an error ErrorDetail = "ERROR" // CriticalDetail is used in logs to discern that it is a critical error CriticalDetail = "CRITICAL" // FatalDetail is used in logs to discern that it is a fatal error FatalDetail = "FATAL" // InfoColor defines the color for info logs InfoColor = "\033[0;32m" // WarnColor defines the color for warning logs WarnColor = "\033[1;33m" // ErrorColor defines the color for error logs ErrorColor = "\033[0;31m" // CriticalColor defines the color for critical logs CriticalColor = "\033[1;31m" // FatalColor defines the color for fatal logs FatalColor = "\033[0;35m" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct { Type int `json:"type"` Text string `json:"text"` TimeStamp time.Time `json:"timestamp"` Error error `json:"error"` StackTrace string `json:"stackTrace"` SpecialAppend string `json:"special"` JobID string `json:"jobId"` Job string `json:"job"` OrgCode string `json:"org_code"` JobInSource string `json:"inSource"` JobOutSource string `json:"outSource"` IsDebug bool `json:"isDebug"` Slack bool `json:"slack"` }
Log is a struct that holds all the information required to log an event
func Criticalf ¶
Criticalf creates a log for series issues that occur in the application allowing a formatting string to be passed for the log rather than a straight string parameter
func Debugf ¶
Debugf creates a log for helpful information that might not be needed allowing a formatting string to be passed for the log rather than a straight string parameter
func Errorf ¶
Errorf creates a log for events that prevent normal flow of the application allowing a formatting string to be passed for the log rather than a straight string parameter
func Fatalf ¶
Fatalf creates a log for serious events that occur during execution allowing a formatting string to be passed for the log rather than a straight string parameter noinspection GoUnusedExportedFunction
func Infof ¶
Infof creates a log for non-serious information allowing a formatting string to be passed for the log rather than a straight string parameter
func Warning ¶
Warning creates a log for concerning information that does not stop the flow of the application but is concerning
func Warningf ¶
Warningf creates a log for concerning information that does not stop the flow of the application but is concerning allowing a formatting string to be passed for the log rather than a straight string parameter
func (Log) Debug ¶
Debug turns on the debug flag in the log and returns the log so that the methods may be chained
func (Log) Special ¶
Special sets the SpecialAppend field which is used when extra information needs to be included in the log
func (Log) ToConsoleString ¶
ToConsoleString returns the string formatted for the console
func (Log) TypeToColorCode ¶
TypeToColorCode returns the characters that change the terminal output color according to the log type
func (Log) TypeToString ¶
TypeToString returns a readable version of the log type
type Logger ¶
type Logger interface {
Send(log Log)
}
Logger is the interface that defines the required method for processing a log
func NewLogStream ¶
func NewLogStream(ctx context.Context, dbconn connection.DatabaseConnection, logconfig config) (Logger, error)
NewLogStream creates and returns a logger
type SNSClient ¶
type SNSClient struct {
// contains filtered or unexported fields
}
SNSClient can be used for pushing messages to a topic which are then emailed to all users who are subscribed to that topic
func NewSNSClient ¶
NewSNSClient creates a client for creating emails VIA Amazon SNS using the [default] credentials stored in ~/.aws/credentials
func (*SNSClient) PushMessage ¶
PushMessage pushes the message to sns