Documentation
¶
Overview ¶
Copyright (c) 2025 Chakib Ben Ziane <contact@blob42.xyz> and [`gosuki` contributors](https://github.com/blob42/gosuki/graphs/contributors). All rights reserved.
SPDX-License-Identifier: AGPL-3.0-or-later
This file is part of GoSuki.
GoSuki is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
GoSuki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with gosuki. If not, see <http://www.gnu.org/licenses/>.
Index ¶
Constants ¶
const ( Release = iota Dev Silent = math.MaxInt )
log level shortcuts
const EnvGosukiDebug = "GOSUKI_DEBUG"
const TraceLevel = log.DebugLevel - 1
Variables ¶
var ( ErrUnknownLevel = errors.New("unknown debug level") ErrHelpQuit = errors.New("help quit") ErrParseSubLevel = errors.New("cannot parse unit level") )
errors
var ( //RELEASE: Change to Release for release mode LoggingMode = Dev TUIMode bool SilentMode bool )
var DebugFlag = &cli.StringFlag{ Name: "debug", Usage: debugHelp, DefaultText: "warn", Sources: cli.EnvVars(EnvGosukiDebug), Action: func(_ context.Context, _ *cli.Command, val string) error { if SilentMode { SetLevel(Silent) } return ParseDebugLevels(val) }, }
var ( DefaultLogLevels = map[int]log.Level{ Release: log.WarnLevel, Dev: log.DebugLevel, } )
var (
Stdout io.Writer
)
log level strings
Functions ¶
func ParseDebugLevels ¶ added in v1.2.0
func SetUnitLevel ¶ added in v1.2.0
Types ¶
type Logger ¶ added in v1.2.0
func NewFileLogger ¶
NewFileLogger creates a new logger that outputs to a specified file.
func (*Logger) WithPrefix ¶ added in v1.2.0
type TailBuffer ¶
type TailBuffer struct {
// contains filtered or unexported fields
}
TailBuffer is a struct that maintains a buffer of the last N lines written to it.
func NewTailBuffer ¶
func NewTailBuffer(n int) *TailBuffer
func (*TailBuffer) Lines ¶
func (t *TailBuffer) Lines() []string