vslog

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

Vslog - Very simple log

License

Flags

STDOUT: Logs to the OS Stdout output

STDERR: Logs to the OS Stderr output

FILE: Create a Logs directory and inside a folder with the logger name

Usage

package main

import "github.com/juanleung/vslog"

func main() {
  logger, err := vslog.GetLogger(vslog.STDOUT|vslog.FILE, "loggerName" /* optional */)
  logger.Info("A very simple logger")
}

Documentation

Index

Constants

View Source
const (
	STDOUT = 1 << iota
	STDERR
	FILE
)

Constant that define where the logger will be writing

View Source
const DateTimeFormat = "02-01-2006 15:04:05"

DateTimeFormat defines the custom date and time format for logs

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger is the logging object

func GetLogger

func GetLogger(flags int, name ...string) (*Logger, error)

GetLogger is a function that creates a new logger If name is not provided, it uses the caller function name

func (*Logger) Debug added in v0.3.0

func (l *Logger) Debug(message string)

Debug registers a log message with the Debug level

func (*Logger) Debugf added in v0.3.0

func (l *Logger) Debugf(message string, a ...interface{})

Debugf register a log message with string interpolation and Debug level

func (*Logger) Error

func (l *Logger) Error(message string)

Error registers a log message with Error level

func (*Logger) Errorf

func (l *Logger) Errorf(message string, a ...interface{})

Errorf register a log message with string interpolation and Error level

func (*Logger) Info

func (l *Logger) Info(message string)

Info registers a log message with the Info level

func (*Logger) Infof

func (l *Logger) Infof(message string, a ...interface{})

Infof register a log message with string interpolation and Info level

func (*Logger) Warning added in v0.3.0

func (l *Logger) Warning(message string)

Warning registers a log message with the Warning level

func (*Logger) Warningf added in v0.3.0

func (l *Logger) Warningf(message string, a ...interface{})

Warningf register a log message with string interpolation and Warning level

Jump to

Keyboard shortcuts

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