lepora

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 10 Imported by: 0

README

Project logo

Lepora

Status GitHub Issues GitHub Pull Requests License


The best logger fo your project written in Go, with support for postgres and mongodb persistence.


📝 Table of Contents

🧐 About

This is a logger that has support for local file writes and database persistence. It has additional dashboards for viewing logs in a web browser.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

A system running go. You can check if you have go on your system by running

go version

Installing

Run

go get github.com/augani/lepora@v0.1.0

🎈 Usage

package main

import (
  "github.com/augani/lepora"
)

func main(){
  lep, err := lepora.Setup(lepora.LeporaOptions{
    // Options
    // Local means a local file will be created for logging
		Method: lepora.Local,
    //Name is your app name that will be used to name the log file
		Name: "AppTest",
    // Max size is the maximum size of the log file in bytes
		MaxSize: 1024,
    // Max files is the maximum number of log files you want to have
		MaxFiles: 5,
    // max days is the maximum number of days you want to keep logs for
		MaxDays: 7,
    // Debug is a boolean that determines if you want to log debug messages
		Debug: true,
	})

  if err != nil {
    panic(err)
  }

  lep.Log("key", "value", "key2", "value2")

  // Logs will be in key value pairs of any number
}

⛏️ Built Using

✍️ Authors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeporaMode

type LeporaMode string
var (
	Managed LeporaMode = "managed"
	Self    LeporaMode = "self"
	Matrix  LeporaMode = "matrix"
	Local   LeporaMode = "local"
)

type LeporaOptions

type LeporaOptions struct {
	//the method of logging, local, managed, self-managed or matrix which is a combination of local and managed logging
	Method LeporaMode
	//the path to the log file
	Path string
	//the name of the log file
	Name string
	//the maximum size of the log file
	MaxSize int
	//the maximum number of log files
	MaxFiles int
	//the maximum number of days to keep the log files
	MaxDays int
	//debug mode on or off
	Debug bool
	//the level of logging
	Level string
	//should logs be persisted
	Persist *bool
	//AutoClean log files
	AutoClean *bool
}

type Logger

type Logger interface {
	Log(args ...interface{})
}

func Setup

func Setup(options LeporaOptions) (Logger, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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