Skip to content

hyperscale-stack/logger

Repository files navigation

Hyperscale logger Last release Documentation

Go Report Card

Branch Status Coverage
master Build Status Coveralls

The Hyperscale logger is an standard interface for abstract logger provider

Example

package main

import (
    "fmt"
    "github.com/hyperscale-stack/logger"
)

func main() {
    l := NewStandardLogger(&outBuf, &errBuf)

	l.Panic("my panic message without option")
	l.Fatal("my fatal message without option")
	l.Error("my error message without option")
	l.Warning("my warning message without option")
	l.Info("my info message without option")
	l.Debug("my debug message without option")
	l.Trace("my trace message without option")

    labels := map[string]interface{}{
		"foo": "bar",
	}

	l.Panic("my panic message with option labels", WithLabels(labels))
	l.Fatal("my fatal message with option labels", WithLabels(labels))
	l.Error("my error message with option labels", WithLabels(labels))
	l.Warning("my warning message with option labels", WithLabels(labels))
	l.Info("my info message with option labels", WithLabels(labels))
	l.Debug("my debug message with option labels", WithLabels(labels))
	l.Trace("my trace message with option labels", WithLabels(labels))


    l.Panic("my panic message with option format: %s => %d", WithFormat("foo", 1))
	l.Fatal("my fatal message with option format: %s => %d", WithFormat("foo", 1))
	l.Error("my error message with option format: %s => %d", WithFormat("foo", 1))
	l.Warning("my warning message with option format: %s => %d", WithFormat("foo", 1))
	l.Info("my info message with option format: %s => %d", WithFormat("foo", 1))
	l.Debug("my debug message with option format: %s => %d", WithFormat("foo", 1))
	l.Trace("my trace message with option format: %s => %d", WithFormat("foo", 1))
}

License

Hyperscale logger is licensed under the MIT license.