lagra

package module
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

README

= LAGRA: A Go Logging Library

image::lagra.png[LAGRA Logo]

== Description

LAGRA is a Go logging library designed to be easy, efficient, fast, and lightweight with zero allocations. It offers advanced logging customization options and serves as an alternative to Zerolog and Logrus.

=== LAGRA is 8 times faster than "fmt" and 2.28 times faster than "Zerolog". Test done via "testing", link:https://github.com/simplyYan/LAGRA/blob/main/benchmark.redhat[click here]. Test carried out on 14/09/2023.

== Installation

To get started with LAGRA, you can add it to your Go project using `go get`:

[source,shell]
----
go get -u github.com/simplyYan/LAGRA
----

== Documentation

To read the documentation, go to https://github.com/simplyYan/LAGRA/wiki/Documentation

== Features and Advantages

LAGRA offers several features and advantages that make it a solid choice for your Go logging needs:

1. *Easy to Use*: LAGRA is designed for simplicity. You can start logging with just a few lines of code.

2. *Efficiency and Zero Allocation*: LAGRA is resource-efficient and minimizes memory allocations, ensuring high performance.

3. *Log Levels*: It supports different log levels (debug, info, warning, error) so you can control the granularity of recorded messages.

4. *Customization*: You can customize the log message output format to suit different contexts and project requirements.

5. *Log Destinations*: In addition to printing logs to the console, LAGRA allows you to direct logs to different destinations, such as files, network outputs, or even third-party systems.

6. *Simple Configuration*: LAGRA's configuration is straightforward and human-readable, making log customization easy.

7. *Extensive Documentation*: The library comes with comprehensive documentation and usage examples to help you make the most of its features.

8. *Open Source License*: LAGRA is distributed under the MIT license, allowing you to use it in both commercial and open-source projects without restrictions.

9. *Active Community*: The Go developer community is active and ready to provide support and contributions to LAGRA.

LAGRA is a solid choice for those seeking an efficient, user-friendly, and highly customizable logging solution in Go.

> By Wesley Yan Soares Brehmer, CEO/Founder of SwankyNoob

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCollector

type ErrorCollector struct {
	// contains filtered or unexported fields
}

func Tracker added in v1.1.7

func Tracker() *ErrorCollector

func (*ErrorCollector) Errors

func (ec *ErrorCollector) Errors() []error

func (*ErrorCollector) Handle

func (ec *ErrorCollector) Handle() bool

func (*ErrorCollector) N

func (ec *ErrorCollector) N(err error)

type Lagra

type Lagra struct {
	// contains filtered or unexported fields
}

func New

func New(tomlConfig string) (*Lagra, error)

New creates a new Lagra logger instance with optional TOML configuration.

func (*Lagra) Error

func (l *Lagra) Error(ctx context.Context, message string, customLogPath ...string) error

Error logs an error message with optional custom log file path.

func (*Lagra) Info

func (l *Lagra) Info(ctx context.Context, message string, customLogPath ...string) error

Info logs an informational message with optional custom log file path.

func (*Lagra) SetLogFile

func (l *Lagra) SetLogFile(filePath string)

SetLogFile sets the log file path.

func (*Lagra) SetLogLevel

func (l *Lagra) SetLogLevel(level string)

SetLogLevel sets the log level (INFO, WARN, ERROR).

func (*Lagra) Warn

func (l *Lagra) Warn(ctx context.Context, message string, customLogPath ...string) error

Warn logs a warning message with optional custom log file path.

type LagraConfig

type LagraConfig struct {
	LogFile  string `toml:"log_file"`
	LogLevel string `toml:"log_level"`
}

type LogType

type LogType string
const (
	Info  LogType = "INFO"
	Warn  LogType = "WARN"
	Error LogType = "ERROR"
)

type StrSelect

type StrSelect struct {
	// contains filtered or unexported fields
}

func NewStrSelect

func NewStrSelect() *StrSelect

func (*StrSelect) SelectStr

func (s *StrSelect) SelectStr(strName, delimiter string) string

func (*StrSelect) SetStr

func (s *StrSelect) SetStr(strName, value string)

Jump to

Keyboard shortcuts

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