logging is an extension to that includes a cloudwatch logs logger



    View Source
    const (
    	TRACE   = logrus.TraceLevel
    	DEBUG   = logrus.DebugLevel
    	INFO    = logrus.InfoLevel
    	WARNING = logrus.WarnLevel
    	ERROR   = logrus.ErrorLevel
    	FATAL   = logrus.FatalLevel
    	PANIC   = logrus.PanicLevel


    This section is empty.


    func New

    func New(hooks ...logrus.Hook) (logger *logrus.Logger)

      New returns a new logrus logger and adds all the hooks


      type CloudWatchLogWriter

      type CloudWatchLogWriter struct {
      	GroupName  *string
      	StreamName *string
      	KMSKeyId   *string
      	GroupTags  map[string]*string
      	// contains filtered or unexported fields

        CloudWatchLogWriter used as a writer for putting events into cloudwatch logs

        func NewCloudWatchLogWriter

        func NewCloudWatchLogWriter(sess *session.Session, groupName, streamName string) *CloudWatchLogWriter

          NewCloudWatchLogWriter creates a new CloudWatchLogWriter with given aws session, group name and stream name

          func (*CloudWatchLogWriter) AddTags

          func (c *CloudWatchLogWriter) AddTags(tags map[string]string) *CloudWatchLogWriter

            AddTags adds tags to the cloudwatch group

            func (*CloudWatchLogWriter) SetKMSKeyID

            func (c *CloudWatchLogWriter) SetKMSKeyID(kmsKey string) *CloudWatchLogWriter

              SetKMSKeyID sets the KMS key Id for this CloudWatchLogWriter

              func (*CloudWatchLogWriter) Write

              func (c *CloudWatchLogWriter) Write(p []byte) (n int, err error)

                Write puts new event into cloudwatch

                type Logrus

                type Logrus interface {
                	WithFields(fields logrus.Fields) *logrus.Entry
                	WithField(key string, value interface{}) *logrus.Entry

                  Logrus allows passing of a logger or entry

                  type StandardLogger

                  type StandardLogger interface {
                  	Debugf(string, ...interface{})
                  	Infof(string, ...interface{})
                  	Warnf(string, ...interface{})
                  	Errorf(string, ...interface{})
                  	Fatalf(string, ...interface{})
                  	Panicf(string, ...interface{})

                    StandardLogger is used in place of a standard logger instance to ensure compatibility with any logger

                    type Writer

                    type Writer struct {
                    	Writer    io.Writer `validate:"required"`
                    	LogLevels []logrus.Level
                    	Format    logrus.Formatter

                      Writer represents a single Logger handler that implements the logrus hook interface

                      func NewWriter

                      func NewWriter(writer io.Writer, levels ...logrus.Level) *Writer

                        NewWriter returns a new handler with the required writer and log level

                        func (*Writer) AddLevels

                        func (w *Writer) AddLevels(levels ...logrus.Level) *Writer

                          Add Levels adds levels to this handler

                          func (*Writer) Fire

                          func (w *Writer) Fire(entry *logrus.Entry) error

                            Fire will format the text and then write to the writer

                            func (*Writer) Levels

                            func (w *Writer) Levels() []logrus.Level

                              Levels returns the log levels for this Writer. If none were set, the default levels are passed which includes all levels

                              func (*Writer) SetFormat

                              func (w *Writer) SetFormat(format logrus.Formatter) *Writer

                                SetFormat sets the logging handler's formatter as a string

                                Source Files