log

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package log provides structured logging functionality for ghtkn. It uses slog with tint handler for colored output to stderr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger added in v0.2.0

func InitLogger(l *Logger)

InitLogger initializes any nil logging functions in the provided Logger with default implementations. This function allows partial customization of logging behavior by only overriding specific log functions while falling back to defaults for unset functions.

Types

type Logger

type Logger struct {
	// Expire logs when an access token expiration date is processed.
	Expire func(logger *slog.Logger, exDate time.Time)
	// FailedToOpenBrowser logs when the browser cannot be opened for authentication.
	FailedToOpenBrowser func(logger *slog.Logger, err error)
	// FailedToGetAccessTokenFromKeyring logs when access token retrieval from keyring fails.
	FailedToGetAccessTokenFromKeyring func(logger *slog.Logger, err error)
	// AccessTokenIsNotFoundInKeyring logs when no access token is found in the keyring.
	AccessTokenIsNotFoundInKeyring func(logger *slog.Logger)
	// FailedToGetAppFromKeyring logs when app retrieval from keyring fails.
	FailedToGetAppFromKeyring func(logger *slog.Logger, err error)
	// AppIsNotFoundInKeyring logs when no app is found in the keyring.
	AppIsNotFoundInKeyring func(logger *slog.Logger)
}

Logger provides structured logging functions for ghtkn operations. Each field is a function that logs specific events with appropriate log levels.

func NewLogger

func NewLogger() *Logger

NewLogger creates a new Logger instance with default logging functions. Each logging function is pre-configured with appropriate log levels and messages.

Jump to

Keyboard shortcuts

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