loggdb

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: GPL-3.0 Imports: 7 Imported by: 3

README

#+title: LogGgb
#+HTML: <a href="https://pkg.go.dev/github.com/m1ndo/LogGdb"></a><img src="https://pkg.go.dev/badge/github.com/m1ndo/LogGdb.svg" alt="Go Reference"></img>

*LogGdb* is a go package that uses /charmbracelet/ "Log" to quickly add a logger in your project.
Its also supports debugging code incase of a Fatal error.
* Install && Usage
To use LogGdb
#+begin_src bash
go get github.com/m1ndo/LogGdb
#+end_src
#+begin_src go
import loggdb "github.com/m1ndo/LogGdb"

type App struct {
	Logger *loggdb.Logger
}

func NewApp() *App {
	a := &App{Logger: &loggdb.Logger{}}
	if err := Logger.NewLogger(); err!= nil {
		panic(err)
	}
	a.Logger.Log.Info("Hello World")
	// To Disable The GDB backTrace .
	a.Logger.Gdb.Disable(true)
	// Rest of the App / Project
	return a
}
#+end_src
*Further* examples check folder =examples/=

* License
GPLv3

Documentation

Index

Constants

View Source
const (
	Info  = log.InfoLevel
	Debug = log.DebugLevel
	Warn  = log.WarnLevel
	Error = log.ErrorLevel
	Fatal = log.FatalLevel
)

Constants

Variables

View Source
var (
	DebugPrint = func(format string, data ...interface{}) {
		fmt.Printf(format+"\n", data...)
	}
)

Functions

This section is empty.

Types

type CustomOpt

type CustomOpt struct {
	Prefix          string
	TimeFunction    func() time.Time
	TimeFormat      string
	ReportTimestamp bool
	ReportCaller    bool
	LogFileName     string
}

CustomOpt Optional Options to pass to log

type Logger

type Logger struct {
	*log.Logger
	Options    *log.Options
	LogWriter  io.Writer
	LogOptions *CustomOpt
	LogDir     string
	Gdb        errlog.Logger
}

Logger Main Logger Definition

func (*Logger) NewLogger

func (Log *Logger) NewLogger() error

NewLogger Creates a new Logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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