Documentation ¶
Overview ¶
Author: Chuck Sailer Date: 2023-04-20 Description: This file contains the code for the CloudWatchLogger struct and its methods.
Index ¶
- type CloudWatchLogger
- func (cwl *CloudWatchLogger) Close() error
- func (cwl *CloudWatchLogger) Debug(msg string, args ...interface{})
- func (cwl *CloudWatchLogger) Error(msg string, args ...interface{})
- func (cwl *CloudWatchLogger) Info(msg string, args ...interface{})
- func (cwl *CloudWatchLogger) Warn(msg string, args ...interface{})
- type FileLogger
- type ILogger
- type LogMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudWatchLogger ¶
type CloudWatchLogger struct {
// contains filtered or unexported fields
}
CloudWatchLogger is a logger that writes log messages to CloudWatch.
func NewCloudWatchLogger ¶
func NewCloudWatchLogger(logGroupName, logStreamName string) (*CloudWatchLogger, error)
NewCloudWatchLogger creates a new CloudWatchLogger.
func (*CloudWatchLogger) Close ¶
func (cwl *CloudWatchLogger) Close() error
Close stops the CloudWatch logger.
func (*CloudWatchLogger) Debug ¶
func (cwl *CloudWatchLogger) Debug(msg string, args ...interface{})
Debug writes a debug log message to CloudWatch.
func (*CloudWatchLogger) Error ¶
func (cwl *CloudWatchLogger) Error(msg string, args ...interface{})
Error writes an error log message to CloudWatch.
func (*CloudWatchLogger) Info ¶
func (cwl *CloudWatchLogger) Info(msg string, args ...interface{})
Info writes an informational log message to CloudWatch.
func (*CloudWatchLogger) Warn ¶
func (cwl *CloudWatchLogger) Warn(msg string, args ...interface{})
Warn writes a warning log message to CloudWatch.
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
func NewFileLogger ¶
func NewFileLogger(logDirectory, logFilePrefix string, maxFileSize int64) (*FileLogger, error)
func (*FileLogger) Close ¶
func (fl *FileLogger) Close()
func (*FileLogger) Debug ¶
func (fl *FileLogger) Debug(msg string, args ...interface{})
implement ILogger interface
func (*FileLogger) Error ¶
func (fl *FileLogger) Error(msg string, args ...interface{})
func (*FileLogger) Info ¶
func (fl *FileLogger) Info(msg string, args ...interface{})
func (*FileLogger) Warn ¶
func (fl *FileLogger) Warn(msg string, args ...interface{})
type ILogger ¶
type ILogger interface { // Debug logs a message at level Debug on the standard logger. Debug(msg string, args ...interface{}) // Info logs a message at level Info on the standard logger. Info(msg string, args ...interface{}) // Warn logs a message at level Warn on the standard logger. Warn(msg string, args ...interface{}) // Error logs a message at level Error on the standard logger. Error(msg string, args ...interface{}) // Close closes the logger. Close() }
Logger is the interface that all loggers must implement.
type LogMessage ¶
type LogMessage struct { LogGroupName string // Name of the log group to write to LogStreamName string // Name of the log stream to write to Message string // Log message to write }
LogMessage is a struct that contains the information needed to write a log message to CloudWatch.
func NewLogMessage ¶
func NewLogMessage(logGroupName, logStreamName, message string) LogMessage
NewLogMessage creates a new LogMessage struct.