logs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsynchronousLoggers

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

func (*AsynchronousLoggers) Check

func (l *AsynchronousLoggers) Check() error

func (*AsynchronousLoggers) Close

func (l *AsynchronousLoggers) Close() error

func (*AsynchronousLoggers) GetLoggerSource

func (l *AsynchronousLoggers) GetLoggerSource() string

func (*AsynchronousLoggers) Log

func (l *AsynchronousLoggers) Log(output ...interface{})

func (*AsynchronousLoggers) LogError

func (l *AsynchronousLoggers) LogError(err ...interface{})

func (*AsynchronousLoggers) SetLogSource

func (l *AsynchronousLoggers) SetLogSource(source string) error

func (*AsynchronousLoggers) SetLoggerSource

func (l *AsynchronousLoggers) SetLoggerSource(source string) error

type DiodeWriter

type DiodeWriter struct {
	WriterWithSource
	// contains filtered or unexported fields
}

func (*DiodeWriter) Close

func (w *DiodeWriter) Close() error

func (*DiodeWriter) SetSource

func (w *DiodeWriter) SetSource(source string) error

func (*DiodeWriter) Write

func (w *DiodeWriter) Write(p []byte) (n int, err error)

type FileLoggers

type FileLoggers struct {
	GenericLoggers
	File *os.File
}

func (*FileLoggers) Check

func (l *FileLoggers) Check() (err error)

func (*FileLoggers) Close

func (l *FileLoggers) Close() (err error)

Closes the logger

type GenericLoggers

type GenericLoggers struct {
	Output *log.Logger
	Error  *log.Logger
}

Definition of command loggers

func (*GenericLoggers) Check

func (l *GenericLoggers) Check() error

Checks whether the loggers are correctly defined or not.

func (*GenericLoggers) Close

func (l *GenericLoggers) Close() error

Closes the logger

func (*GenericLoggers) Log

func (l *GenericLoggers) Log(output ...interface{})

Logs to the output logger.

func (*GenericLoggers) LogError

func (l *GenericLoggers) LogError(err ...interface{})

Logs to the Error logger.

func (*GenericLoggers) SetLogSource

func (l *GenericLoggers) SetLogSource(source string) error

func (*GenericLoggers) SetLoggerSource

func (l *GenericLoggers) SetLoggerSource(source string) error

type JSONLoggers

type JSONLoggers struct {
	Loggers

	Zerologger zerolog.Logger
	// contains filtered or unexported fields
}

Definition of JSON message loggers

func (*JSONLoggers) Check

func (l *JSONLoggers) Check() error

Checks whether the loggers are correctly defined or not.

func (*JSONLoggers) Close

func (l *JSONLoggers) Close() error

Closes the logger

func (*JSONLoggers) Configure

func (l *JSONLoggers) Configure() error

func (*JSONLoggers) GetLoggerSource

func (l *JSONLoggers) GetLoggerSource() string

func (*JSONLoggers) GetSource

func (l *JSONLoggers) GetSource() string

func (*JSONLoggers) Log

func (l *JSONLoggers) Log(output ...interface{})

Logs to the output logger.

func (*JSONLoggers) LogError

func (l *JSONLoggers) LogError(err ...interface{})

Logs to the Error logger.

func (*JSONLoggers) SetLogSource

func (l *JSONLoggers) SetLogSource(source string) error

func (*JSONLoggers) SetLoggerSource

func (l *JSONLoggers) SetLoggerSource(source string) error

type Loggers

type Loggers interface {
	io.Closer
	// Checks whether the loggers are correctly defined or not.
	Check() error
	// Sets the source of the log message e.g. related build job, related command, etc.
	SetLogSource(source string) error
	// Sets the source of the logger e.g. APIs, Build worker, CMSIS tools.
	SetLoggerSource(source string) error
	// Logs to the output logger.
	Log(output ...interface{})
	// Logs to the Error logger.
	LogError(err ...interface{})
}

func CreateFileLogger

func CreateFileLogger(logFile string, loggerSource string) (loggers Loggers, err error)

Creates a logger to a file

func CreateStdLogger

func CreateStdLogger(loggerSource string) (loggers Loggers, err error)

Creates a logger to standard output/error

func NewAsynchronousLoggers

func NewAsynchronousLoggers(slowOutputWriter WriterWithSource, slowErrorWriter WriterWithSource, ringBufferSize int, pollInterval time.Duration, loggerSource string, source string, droppedMessagesLogger Loggers) (loggers Loggers, err error)

func NewAsynchronousStdLogger

func NewAsynchronousStdLogger(loggerSource string, ringBufferSize int, pollInterval time.Duration, source string) (loggers Loggers, err error)

func NewJSONLogger

func NewJSONLogger(writer WriterWithSource, loggerSource string, source string) (loggers Loggers, err error)

func NewJSONLoggerForSlowWriter

func NewJSONLoggerForSlowWriter(slowWriter WriterWithSource, ringBufferSize int, pollInterval time.Duration, loggerSource string, source string, droppedMessagesLogger Loggers) (loggers Loggers, err error)

NewJSONLoggerForSlowWriter creates a lock free, non blocking & thread safe logger wrapped around slowWriter

params:

slowWriter : writer used to write data streams
ringBufferSize : size of ring buffer used to receive messages
pollInterval : polling duration to check buffer content
loggerSource : logger application name
source : source string
droppedMessagesLogger : logger for dropped messages

If pollInterval is greater than 0, a poller is used otherwise a waiter is used.

func NewLogrusLogger

func NewLogrusLogger(logrusL *logrus.Logger, loggerSource string) (loggers Loggers, err error)

Creates a logger to logrus logger (https://github.com/Sirupsen/logrus)

func NewNoopLogger

func NewNoopLogger(loggerSource string) (loggers Loggers, err error)

type MultipleWritersWithSource

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

func CreateMultipleWritersWithSource

func CreateMultipleWritersWithSource(writers ...WriterWithSource) (writer *MultipleWritersWithSource, err error)

func (*MultipleWritersWithSource) AddWriters

func (w *MultipleWritersWithSource) AddWriters(writers ...WriterWithSource) error

func (*MultipleWritersWithSource) Close

func (w *MultipleWritersWithSource) Close() (err error)

func (*MultipleWritersWithSource) GetWriters

func (w *MultipleWritersWithSource) GetWriters() ([]WriterWithSource, error)

func (*MultipleWritersWithSource) SetSource

func (w *MultipleWritersWithSource) SetSource(source string) (err error)

func (*MultipleWritersWithSource) Write

func (w *MultipleWritersWithSource) Write(p []byte) (n int, err error)

type StdErrWriter

type StdErrWriter struct {
	WriterWithSource
}

func (*StdErrWriter) Close

func (w *StdErrWriter) Close() error

func (*StdErrWriter) SetSource

func (w *StdErrWriter) SetSource(source string) error

func (*StdErrWriter) Write

func (w *StdErrWriter) Write(p []byte) (n int, err error)

type StdWriter

type StdWriter struct {
	WriterWithSource
}

func (*StdWriter) Close

func (w *StdWriter) Close() error

func (*StdWriter) SetSource

func (w *StdWriter) SetSource(source string) error

func (*StdWriter) Write

func (w *StdWriter) Write(p []byte) (n int, err error)

type StringLoggers

type StringLoggers struct {
	GenericLoggers
	LogWriter StringWriter
}

func CreateStringLogger

func CreateStringLogger(loggerSource string) (loggers *StringLoggers, err error)

Creates a logger to standard output/error

func (*StringLoggers) Check

func (l *StringLoggers) Check() error

func (*StringLoggers) Close

func (l *StringLoggers) Close() (err error)

Closes the logger

func (*StringLoggers) GetLogContent

func (l *StringLoggers) GetLogContent() string

type StringWriter

type StringWriter struct {
	io.WriteCloser

	Logs strings.Builder
	// contains filtered or unexported fields
}

func (*StringWriter) Close

func (w *StringWriter) Close() (err error)

func (*StringWriter) GetFullContent

func (w *StringWriter) GetFullContent() string

func (*StringWriter) Write

func (w *StringWriter) Write(p []byte) (n int, err error)

type WriterWithSource

type WriterWithSource interface {
	io.WriteCloser
	SetSource(source string) error
}

func NewDiodeWriterForSlowWriter

func NewDiodeWriterForSlowWriter(slowWriter WriterWithSource, ringBufferSize int, pollInterval time.Duration, droppedMessagesLogger Loggers) WriterWithSource

Jump to

Keyboard shortcuts

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