holmes

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 1 Imported by: 2

README

Holmes

How to use

Debug level

package main

import github.com/attreios/holmes

func main(){
  h := holmes.New("debug", "example")
  h.Info("%s using function: %s", "Output", "Info")
  h.Error("%s using function: %s", "Output", "Error")
  h.Debug("%s using function: %s", "Output", "Debug")
}

Output:

YYYY/MM/DD HH:MM:SS example INFO: Output using function: Info
YYYY/MM/DD HH:MM:SS example ERROR: Output using function: Error
YYYY/MM/DD HH:MM:SS example DEBUG: Output using function: Debug

Info level

package main

import github.com/attreios/holmes

func main(){
  h := holmes.New("info", "example")
  h.Info("%s using function: %s", "Output", "Info")
  h.Error("%s using function: %s", "Output", "Error")
  h.Debug("%s using function: %s", "Output", "Debug")
}

Output:

YYYY/MM/DD HH:MM:SS example INFO: Output using function: Info
YYYY/MM/DD HH:MM:SS example ERROR: Output using function: Error

h.Debug was ignored because the log level is info.

Error level

package main

import github.com/attreios/holmes

func main(){
  h := holmes.New("error", "example")
  h.Info("%s using function: %s", "Output", "Info")
  h.Error("%s using function: %s", "Output", "Error")
  h.Debug("%s using function: %s", "Output", "Debug")
}

Output:

YYYY/MM/DD HH:MM:SS example ERROR: Output using function: Error

h.Debug and h.Info were ignored because the log level is error.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	Level  string
	Module string
}

func New

func New(level, module string) *Logger

func (Logger) Debug

func (c Logger) Debug(message string, args ...interface{})

func (Logger) Error

func (c Logger) Error(message string, args ...interface{})

func (Logger) FatalError

func (c Logger) FatalError(message string, args ...interface{})

func (Logger) Info

func (c Logger) Info(message string, args ...interface{})

Jump to

Keyboard shortcuts

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