logger

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 7 Imported by: 0

README

** Beskrivning
Enkel go-klient för att skicka loggar till billes logbook

#+BEGIN_EXAMPLE
go get github.com/Billes/go-logger-client
#+END_EXAMPLE

** Typdefinitioner

*** Options
#+BEGIN_EXAMPLE 
type Options struct {
	Host    string
	System  string
	Token   string
	Local   bool
	Timeout int
}
#+END_EXAMPLE
*** Init
Obligatorisk. Måste köras en gång innan man börjar logga 
#+BEGIN_EXAMPLE
func Init(o Options)
#+END_EXAMPLE
*** Logfunktioner
**** Standard
#+BEGIN_EXAMPLE
func Critical(tags []string, message string, data interface{})
func Debug(tags []string, message string, data interface{})
func Error(tags []string, message string, data interface{})
func Info(tags []string, message string, data interface{})
func Warning(tags []string, message string, data interface{})
#+END_EXAMPLE
**** Fatal - Avslutar efter en critical loggning
#+BEGIN_EXAMPLE
func Fatal(tags []string, message string, data interface{})
#+END_EXAMPLE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Critical

func Critical(tags []string, message string, data interface{})

Critical creates a log for critical error messages. Is synchronous and if you need concurrency run it as a goroutine.

func Debug

func Debug(tags []string, message string, data interface{})

Debug creates a log for debug messages. Is synchronous and if you need concurrency run it as a goroutine.

func Error

func Error(tags []string, message string, data interface{})

Error creates a log for error messages. Is synchronous and if you need concurrency run it as a goroutine.

func Fatal

func Fatal(tags []string, message string, data interface{})

Fatal creates a log for critical error messages and shuts down the server. Is synchronous and should not be ran concurrently as it would defeat the purpose of being a fatal action.

func Info

func Info(tags []string, message string, data interface{})

Info creates a log for informational messages. Is synchronous and if you need concurrency run it as a goroutine.

func Init

func Init(o Options) error

Init bootstraps the config to the logger instance

func Warning

func Warning(tags []string, message string, data interface{})

Warning creates a log for warning messages. Is synchronous and if you need concurrency run it as a goroutine.

Types

type Options

type Options struct {
	Host    string `json:"host"`    // When omitting, logs will be written locally
	System  string `json:"system"`  // Required
	Token   string `json:"token"`   // Required if Host is set
	Local   bool   `json:"local"`   // Default false - If you want to force local logs in addition to the remote ones
	Timeout int    `json:"timeout"` // Default 10 - How long communication with server is allowed to take before giving up and writing a local log
}

Options is the config that is used for bootstrapping the logger. Default is posting logs to remote server but omitting host will write local logs instead.

Jump to

Keyboard shortcuts

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