golog

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: AGPL-3.0 Imports: 6 Imported by: 2

README

golog

Simple golang rotated log.

Install
go get github.com/black40x/golog
Example
package main

import (
	"golog"
)

func main() {
	rl := golog.NewLogger(&golog.Options{
		MaxSize: 10 << 20,
		LogName: "my-log",
		Daily:   true,
	}, golog.Ldate|golog.Ltime)
	defer rl.Close()

	rl.Println("My log")
	rl.Info("My tagged log Info")
	rl.Error("My tagged log Error")
	rl.Warning("My tagged log Warning")
}

Documentation

Index

Constants

View Source
const (
	Ldate = 1 << iota
	Ltime
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func NewLogger

func NewLogger(options *Options, flags int) *Logger

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) Error

func (l *Logger) Error(v string)

func (*Logger) Info

func (l *Logger) Info(v string)

func (*Logger) Println

func (l *Logger) Println(v string, tag ...string)

func (*Logger) Warning

func (l *Logger) Warning(v string)

type Options

type Options struct {
	LogDir     string `yaml:"log_dir"`
	MaxSize    int64  `yaml:"max_size"`
	Daily      bool   `yaml:"daily"`
	LogName    string `yaml:"log_name"`
	DateFormat string `yaml:"date_format"`
}

Jump to

Keyboard shortcuts

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