logging

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package logging will handle multi-level logging for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStringToFile

func AppendStringToFile(path string, input string) error

AppendStringToFile will append input string onto input file.

func GetLogLevel

func GetLogLevel() string

GetLogLevel returns the logging level currently set.

func Init

func Init(cmd *cobra.Command, _ []string) error

Init will initialize the logging to the input level. This is meant to be ran as a PreRunE function in cobra.

func Log

func Log(format string, v ...any)

Log will create a plain log for input string.

func LogDebug

func LogDebug(format string, v ...any)

LogDebug will create a debug log in the form of: callerfile.go:line [debug] message...

func LogError

func LogError(format string, v ...any)

LogError will create an error log in the form of: callerfile.go:line [error] message...

func LogWarning

func LogWarning(format string, v ...any)

LogWarning will create a warning log in the form of: callerfile.go:line [warn] message...

func ReadLog

func ReadLog(file io.Reader, since, until int64, follow, timestamps bool) error

ReadLog will read input file and print. File will be read from since (timestamp) to until (timestamp). File will be continuously read if follow is true. (like tail -f) Timestamps for each line will be shown if timestamps is true. Lines will be printed to stderr or stdout based on where they were meant to be.

Line structure: timestamp:stdout:line

Types

This section is empty.

Jump to

Keyboard shortcuts

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