logging

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 12 Imported by: 0

Documentation

Overview

Package logging maintains interface for two core supported types of logging that occur within Jacamar. First is communication with the job log that is handled via a Messenger. Secondly is the optionally configured system logging that is provided via the Logger. Any system logging is targeted at a privileged user with Jacamar-Auth.

Index

Constants

View Source
const (
	ANSIBoldRed   = "\033[31;1m" // Error
	ANSIBoldGreen = "\033[32;1m" // Notify
	ANSIYellow    = "\033[0;33m" // Warning
	ANSIReset     = "\033[0;m"
)

Using the same codes as upstream GitLab.

Variables

This section is empty.

Functions

func EstablishLogger

func EstablishLogger(
	stage string,
	opts configure.Options,
	req envparser.RequiredEnv,
) (*logrus.Entry, error)

EstablishLogger uses a combination of known/trusted environmental context coupled with administrator configuration to establish rules for Logrus.

Types

type LogFile

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

func (LogFile) Write

func (l LogFile) Write(p []byte) (n int, err error)

type Messenger

type Messenger interface {
	// Stdout prints a formatted message (no color) to stdout.
	Stdout(string, ...interface{})
	// Stderr prints a formatted message (no color) to stderr.
	Stderr(string, ...interface{})
	// Warn prints a formatted message (yellow text) to stdout.
	Warn(string, ...interface{})
	// Notify prints a formatted message (bold green text) to stdout.
	Notify(string, ...interface{})
	// Error prints a formatted message (bold red text) to stderr.
	Error(string, ...interface{})
}

Messenger is the interface to conveying key user information to the current CI job log via stdout/stderr to the GitLab runner. Messages of sufficient lever can be wrapped in appropriate ANSI characters to increase visibility to the user.

func NewMessenger

func NewMessenger() Messenger

NewMessenger generates a functional Messenger interface that should be used to convey details/messages to the job log.

Jump to

Keyboard shortcuts

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