logs

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package logs handles errors and user feedback.

Index

Examples

Constants

View Source
const (
	GapUser  string = "df2"        // GapUser is the configuration and logs subdirectory name.
	Filename string = "errors.log" // Filename is the default error log filename.

)

Variables

View Source
var ErrNoArg = errors.New("no arguments were provided")

Functions

func Arg

func Arg(arg string, exit bool, args ...string) error

Arg returns instructions for invalid command arguments and exits with an error code.

func Danger

func Danger(err error)

Danger logs the error to stdout, but continues the program.

Example
package main

import (
	"github.com/Defacto2/df2/pkg/logs"
	"github.com/gookit/color"
)

func main() {
	color.Enable = false
	logs.Panic(false)
	logs.Danger(logs.ErrATest)
}
Output:

func Fatal

func Fatal(err error)

Fatal logs error to stdout and exits with an error code.

func Filepath

func Filepath(filename string) string

Filepath is the absolute path and filename of the error log file.

func IsQuiet

func IsQuiet() bool

func Log

func Log(err error)

Log the error to stdout, but continue the program.

func Panic

func Panic(b bool)

Panic enables or disables panicking when Danger is used.

func Path

func Path(name string) string

Path returns the named file or directory path with all missing elements marked in red.

func Print

func Print(a ...any)

Print obeys the --quiet flag or formats using the default formats for its operands and writes to standard output.

func Printcr

func Printcr(a ...any)

Printcr obeys the --quiet flag or otherwise erases the current line and writes to standard output.

func Printcrf

func Printcrf(format string, a ...any)

Printcrf obeys the --quiet flag or otherwise erases the current line and formats according to a format specifier.

func Printf

func Printf(format string, a ...any)

Printf obeys the --quiet flag or formats according to a format specifier and writes to standard output.

func Println

func Println(a ...any)

Println obeys the --quiet flag or formats using the default formats for its operands and writes to standard output.

func Quiet

func Quiet(b bool)

Quiet stops most writing to the standard output.

func Simulate

func Simulate()

Simulate prints the --simulate=false flag info.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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