logging

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package logging provides a slog logger configured for releasegen.

Two output modes are supported:

  • GitHub Actions mode (the default when GITHUB_ACTIONS=true is set): records at ERROR level are prefixed with "::error::" so they surface in the Actions UI, and the Group / EndGroup helpers emit the "::group::" / "::endgroup::" markers around per-module work.
  • Local mode: a plain text handler suitable for terminal use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectCI

func DetectCI() bool

DetectCI returns true when running inside GitHub Actions.

func EndGroup

func EndGroup(w io.Writer, ci bool)

EndGroup prints the matching "::endgroup::" marker. Write errors are intentionally ignored: log helpers must not fail the run.

func Group

func Group(w io.Writer, ci bool, title string)

Group prints a "::group::" marker (in CI mode) or a section header (locally). Write errors are intentionally ignored: log helpers must not fail the run.

func New

func New(opts Options) *slog.Logger

New constructs a *slog.Logger using the supplied options.

Types

type Options

type Options struct {
	// Writer is the destination for log records. If nil, os.Stderr is used.
	Writer io.Writer
	// Level is the minimum log level. Defaults to LevelInfo.
	Level slog.Level
	// CI, when true, formats records for GitHub Actions (::error::,
	// ::group::, ::endgroup:: markers). New does not auto-detect this;
	// callers should set it explicitly, typically via DetectCI().
	CI bool
}

Options controls New.

Jump to

Keyboard shortcuts

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