logg

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 4 Imported by: 0

README ¶

🔥 logg

Open Source Cloud logging library in Go.

About the project

  • Connect your golang microservices logs with this engine!
  • Send your logs to kafka, rabbitMQ or REST! And then manage them!
  • Feel free to implement more writers

Instalation

go get -u github.com/hyperyuri/logg

Quick Start

//Setup logger
logger := logg.NewLogger().
WithWriter(writer.WithDebugMode()).
WithDefaultConfig(logg.NewDefaultConfig("team-x", "project-x"))
logger.SetLevels(levels.NewLevels(logger))

//To use the log
logger.Error("This is an example of an error")
  • Check the examples folder to see more options

💪 How to contribute to the project?

  • Do a fork of the project.
  • Submitting issue (please, follow template)
  • Create a new branch with your changes: git checkout -b my-feature
  • Save your changes and create a commit with a message: git commit -m "feature: My new feature"
  • Send your changes and send a PR

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	InfoType = iota
	ErrorType
	WarningType
	PanicType
)

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type DefaultConfig ¶

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

func NewDefaultConfig ¶

func NewDefaultConfig(stack string, app string) *DefaultConfig

NewDefaultConfig create a config that will set your project and the maintainer

type ErrorLevel ¶

type ErrorLevel interface {
	//Error format to an error log and send to some writer
	Error(patter string, args ...interface{})

	//SyncError run in concurrency, format to an error log and send to some writer
	SyncError(patter string, args ...interface{})
}

type InfoLevel ¶

type InfoLevel interface {
	//Info format to a info log and send to some writer
	Info(patter string, args ...interface{})

	//SyncInfo run in concurrency, format to a info log and send to some writer
	SyncInfo(patter string, args ...interface{})
}

type Levels ¶

type Levels interface {
	ErrorLevel
	WarningLevel
	InfoLevel
	PanicLevel
}

type Logger ¶

type Logger struct {
	Levels
	Writer
	// contains filtered or unexported fields
}

func NewLogger ¶

func NewLogger() *Logger

func (*Logger) App ¶

func (l *Logger) App() string

func (*Logger) SetLevels ¶

func (l *Logger) SetLevels(lev Levels)

func (*Logger) Stack ¶

func (l *Logger) Stack() string

func (*Logger) WithDefaultConfig ¶

func (l *Logger) WithDefaultConfig(config *DefaultConfig) *Logger

func (*Logger) WithWriter ¶

func (l *Logger) WithWriter(writer Writer) *Logger

type Message ¶

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

func NewMessage ¶

func NewMessage(level int, text, stack, app string) *Message

NewMessage create the message that will send to writers

func (*Message) String ¶

func (s *Message) String() string

String export the message to string

func (*Message) ToJSON ¶

func (s *Message) ToJSON() interface{}

ToJSON export the message to JSON

type PanicLevel ¶

type PanicLevel interface {
	//Panic format to a PANIC log and send to some writer, after it runs os.Exit
	Panic(patter string, args ...interface{})
}

type WarningLevel ¶

type WarningLevel interface {
	//Warning format to a warning log and send to some writer
	Warning(patter string, args ...interface{})

	//SyncWarning run in concurrency, format to a warning log and send to some writer
	SyncWarning(patter string, args ...interface{})
}

type Writer ¶

type Writer interface {
	//Write should send your message (kafka, rest, rabbit or others)
	Write(m *Message)
}

Directories ¶

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳