Pkg
Log

Log

Explore the following sections to learn more:

log

import "github.com/gemini-oss/rego/pkg/common/log"

pkg/common/log/log.go

Index

Constants

const (
    // Log level constants
    TRACE = iota
    DEBUG
    INFO
    WARNING
    ERROR
    FATAL
    PANIC

    // Color Escape Codes
    Black   = "\033[30m"
    Red     = "\033[31m"
    Green   = "\033[32m"
    Yellow  = "\033[33m"
    Blue    = "\033[34m"
    Magenta = "\033[35m"
    Cyan    = "\033[36m"
    White   = "\033[37m"
    Reset   = "\033[0m"

    // Formatting
    Bold      = "\033[1m"
    Italic    = "\033[3m"
    Underline = "\033[4m"
)

func LogLevel

func LogLevel(level int, color bool) string

* @param {int} level - log level

  • @param {bool} color - enable/disable colorized output
  • @return {string} - string representation of log level

type Logger

type Logger struct {
    Color bool // enable/disable colorized output

    Verbosity int // log level {TRACE, DEBUG, INFO, WARNING, ERROR, FATAL, PANIC}
    // contains filtered or unexported fields
}

func NewLogger

func NewLogger(prefix string, verbosity int) *Logger

* # NewLogger

  • - creates a new Logger with the specified prefix

func (*Logger) Close

func (l *Logger) Close() error

* # log.Close

  • - closes the Logger’s file if it is a *os.File

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

* # log.Debug

  • - logs line at DEBUG level

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

* # log.Debugf

  • - logs formatted message at DEBUG level

func (*Logger) Delete

func (l *Logger) Delete() error

* # log.Delete

  • - Delete the Logger’s file if it is a *os.File

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

* # log.Error

  • - logs formatted message at ERROR level

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

* # log.Errorf

  • - logs formatted message at ERROR level

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

* # log.Fatal

  • - logs line at FATAL level

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

* # log.Fatal

  • - logs formatted message at FATAL level and then calls os.Exit(1)

func (*Logger) Panic

func (l *Logger) Panic(v ...interface{})

* # log.Panic

  • - logs line at PANIC level and then panics

func (*Logger) Panicf

func (l *Logger) Panicf(format string, v ...interface{})

* # log.Panicf

  • - logs formatted message at PANIC level and then panics

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

* # log.Print

  • - logs line at INFO level

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

* # log.Printf

  • - logs formatted message at INFO level

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

* # log.Println

  • - logs line at INFO level

func (*Logger) SetNewFile

func (l *Logger) SetNewFile(logFilePath string)

SetNewFile sets the output destination for the logger to a new file.

func (*Logger) SetOutput

func (l *Logger) SetOutput(output io.Writer)

SetOutput sets the output destination for the logger.

func (*Logger) Trace

func (l *Logger) Trace(v ...interface{})

* # log.Trace

  • - logs line at TRACE level

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

* # log.Tracef

  • - logs formatted message at TRACE level

func (*Logger) Warning

func (l *Logger) Warning(v ...interface{})

* # log.Warning

  • - logs formatted message at WARNING level

func (*Logger) Warningf

func (l *Logger) Warningf(format string, v ...interface{})

* # log.Warningf

  • - logs formatted message at WARNING level

Generated by gomarkdoc