https://github.com/containerscrew/devstdout
Simple slog wrapper pkg
https://github.com/containerscrew/devstdout
golang golang-package logger logging logging-library slog
Last synced: 21 days ago
JSON representation
Simple slog wrapper pkg
- Host: GitHub
- URL: https://github.com/containerscrew/devstdout
- Owner: containerscrew
- License: agpl-3.0
- Created: 2023-06-03T17:26:08.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-30T17:14:52.000Z (over 1 year ago)
- Last Synced: 2025-01-30T18:19:19.773Z (over 1 year ago)
- Topics: golang, golang-package, logger, logging, logging-library, slog
- Language: Go
- Homepage:
- Size: 674 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
devstdout
Simple slog wrapper pkg
Built with ❤ in Golang
**Table of Contents** *generated with [mtoc](https://github.com/containerscrew/mtoc)*
- [devstdout](#devstdout)
- [Examples](#examples)
- [Full code examples](#full-code-examples)
- [Pretty output](#pretty-output)
- [Json output](#json-output)
- [TO DO](#to-do)
- [License](#license)
# devstdout
Simple slog wrapper pkg for my Golang projects.
# Examples
```go
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
* [**json**](./examples/json/json.go)
* [**pretty**](./examples/pretty/pretty.go)
* [**console**](./examples/console/console.go)
## Pretty output

## Json output

# TO DO
* Add tests
* Code refactor is certainly needed!
* AddSource option in logger is too much verbose
# License
[LICENSE](./LICENSE)