Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloudWatchLogEventList ¶
type CloudWatchLogEventList struct {
// contains filtered or unexported fields
}
CloudWatchLogEventList stores a thread safe slice of InputLogEvents. size is the current size in bytes of the log messages.
func (*CloudWatchLogEventList) Add ¶
func (c *CloudWatchLogEventList) Add(message string) error
Add adds a new InputLogEvent to the logEvents slice.
func (*CloudWatchLogEventList) CanAdd ¶
func (c *CloudWatchLogEventList) CanAdd(message []byte) bool
CanAdd checks if message can be added to the logEvents slice by first checking if size will still be less than maxBatchInputLogEventSize with message being appended.
func (*CloudWatchLogEventList) IsFull ¶
func (c *CloudWatchLogEventList) IsFull() bool
IsFull checks if size is greater than or equal to maxBatchInputLogEventSize.
type CloudWatchLogger ¶
type CloudWatchLogger struct {
// contains filtered or unexported fields
}
CloudWatchLogger is a structured logger that logs to CloudWatch and is thread safe.
func NewCloudWatchLogger ¶
func NewCloudWatchLogger(sess *session.Session, logGroupName string, globalFields Fields) (*CloudWatchLogger, error)
NewCloudWatchLogger initializes a new CloudWatchLogger object and returns it. sess is an AWS session. logGroupName is the name of the log group in CloudWatch. globalFields are the fields that are written in every log message.
func (*CloudWatchLogger) Debug ¶
func (c *CloudWatchLogger) Debug(fields Fields) error
Debug writes a log message at a debug level.
func (*CloudWatchLogger) Error ¶
func (c *CloudWatchLogger) Error(fields Fields) error
Error writes a log message at an error level.
func (*CloudWatchLogger) Info ¶
func (c *CloudWatchLogger) Info(fields Fields) error
Info writes a log message at an info level.
type Logger ¶
type Logger interface { Info(fields Fields) error Error(fields Fields) error Debug(fields Fields) error }
Logger is a structured logger interface.
var Log Logger
Log is the package wide Logger. This can be used to have a Logger that is globally available within a codebase.
type StandardLogger ¶
type StandardLogger struct {
// contains filtered or unexported fields
}
StandardLogger is a structured logger that is thread safe.
func NewStandardLogger ¶
func NewStandardLogger(output io.Writer, globalFields Fields) *StandardLogger
NewStandardLogger initializes a new StandardLogger object and returns it. output is the output that the log messages are written to. globalFields are the fields that are written in every log message.
func (*StandardLogger) Debug ¶
func (l *StandardLogger) Debug(fields Fields) error
Debug writes a log message at a debug level.
func (*StandardLogger) Error ¶
func (l *StandardLogger) Error(fields Fields) error
Error writes a log message at an error level.
func (*StandardLogger) Info ¶
func (l *StandardLogger) Info(fields Fields) error
Info writes a log message at an info level.