devstdout

module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: AGPL-3.0

README

logo

devstdout

Simple slog wrapper pkg

Built with ❤ in Golang

Go report card GitHub code size in bytes GitHub go.mod Go version LICENSE LICENSE

Table of Contents generated with mtoc

devstdout

Simple slog wrapper pkg for my Golang projects.

Examples

package main

import (
	devstdout "github.com/containerscrew/devstdout/pkg"
)

func main() {
	log := devstdout.NewLogger(
		devstdout.OptionsLogger{Level: "debug", AddSource: false, LoggerType: "pretty"},
	)

	log.Debug(
		"testing message",
		devstdout.Argument("hello", "world"),
	)

	log.Info(
		"testing message",
		devstdout.Argument("bob", "marley"),
	)

	log.Warning("warning message!")

	log.Success(
		"Success Message",
		devstdout.Argument("alice", "bob"),
	)

	log.Error("error in your app!", devstdout.Argument("error", "your_error_is_here"))

	log.ErrorWithExit("fatal error, app must stop!", devstdout.Argument("error", "your_error_is_here"))
}

Full code examples

Pretty output

example

Json output

example2

TO DO

  • Add tests
  • Code refactor is certainly needed!
  • AddSource option in logger is too much verbose

License

LICENSE

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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