logging

package
v0.0.0-...-9a5c20e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 11 Imported by: 2

README

logging

import "github.com/blueprint-uservices/blueprint/blueprint/pkg/blueprint/logging"

Package logging implements a custom slog logger for Blueprint.

The custom logger adds additional callsite information to logging statements, to provide more information during the compilation process about which plugins are producing logs or errors, and to tie that information back to the corresponding wiring line.

Index

func DisableCompilerLogging

func DisableCompilerLogging()

Disables logging by the compiler; useful when running tests to suppress verbose output.

func EnableCompilerLogging

func EnableCompilerLogging()

Compiler logging is enabled by default; this method is useful for tests to disable and enable logging in order to suppress output.

type Callsite

Used to tie logging statements and errors back to the wiring file line that caused the error

type Callsite struct {
    Source     *sourceFileInfo
    LineNumber int
    Func       string
    FuncName   string
}

func (Callsite) String
func (cs Callsite) String() string

type Callstack

Used to tie logging statements and errors back to the wiring file line that caused the error

type Callstack struct {
    Stack []Callsite
}

func GetCallstack
func GetCallstack() *Callstack

Gets the current callstack including file information. Blueprint's wiring spec uses this so that logging statements and error messages can be attributed back to the appropriate wiring spec line.

func (*Callstack) String
func (stack *Callstack) String() string

Generated by gomarkdoc

Documentation

Overview

Package logging implements a custom slog logger for Blueprint.

The custom logger adds additional callsite information to logging statements, to provide more information during the compilation process about which plugins are producing logs or errors, and to tie that information back to the corresponding wiring line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableCompilerLogging

func DisableCompilerLogging()

Disables logging by the compiler; useful when running tests to suppress verbose output.

func EnableCompilerLogging

func EnableCompilerLogging()

Compiler logging is enabled by default; this method is useful for tests to disable and enable logging in order to suppress output.

Types

type Callsite

type Callsite struct {
	Source     *sourceFileInfo
	LineNumber int
	Func       string
	FuncName   string
}

Used to tie logging statements and errors back to the wiring file line that caused the error

func (Callsite) String

func (cs Callsite) String() string

type Callstack

type Callstack struct {
	Stack []Callsite
}

Used to tie logging statements and errors back to the wiring file line that caused the error

func GetCallstack

func GetCallstack() *Callstack

Gets the current callstack including file information. Blueprint's wiring spec uses this so that logging statements and error messages can be attributed back to the appropriate wiring spec line.

func (*Callstack) String

func (stack *Callstack) String() string

Jump to

Keyboard shortcuts

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