closer to ready
This commit is contained in:
parent
60cb410c32
commit
d8f35dd031
14
README.md
14
README.md
|
@ -1,5 +1,7 @@
|
||||||
# simplelog
|
# simplelog
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
simplelog is an opinionated logging package designed to facilitate easy and
|
simplelog is an opinionated logging package designed to facilitate easy and
|
||||||
structured logging in Go applications with an absolute minimum of
|
structured logging in Go applications with an absolute minimum of
|
||||||
boilerplate.
|
boilerplate.
|
||||||
|
@ -7,12 +9,16 @@ boilerplate.
|
||||||
The idea is that you can add a single import line which replaces the
|
The idea is that you can add a single import line which replaces the
|
||||||
stdlib `log/slog` default handler, and solve the 90% case for logging.
|
stdlib `log/slog` default handler, and solve the 90% case for logging.
|
||||||
|
|
||||||
|
## Current Status
|
||||||
|
|
||||||
|
Pre-1.0, not working yet.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* if output is a tty, outputs pretty color logs
|
- if output is a tty, outputs pretty color logs
|
||||||
* if output is not a tty, outputs json
|
- if output is not a tty, outputs json
|
||||||
* supports delivering logs via tcp RELP (e.g. to remote rsyslog using imrelp)
|
- supports delivering logs via tcp RELP (e.g. to remote rsyslog using imrelp)
|
||||||
* supports delivering each log message via a webhook
|
- supports delivering each log message via a webhook
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,13 @@ package simplelog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
)
|
)
|
||||||
|
@ -81,6 +84,7 @@ func (cl *MultiplexHandler) WithGroup(name string) slog.Handler {
|
||||||
}
|
}
|
||||||
return &MultiplexHandler{handlers: newHandlers}
|
return &MultiplexHandler{handlers: newHandlers}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExtendedEvent interface {
|
type ExtendedEvent interface {
|
||||||
GetID() uuid.UUID
|
GetID() uuid.UUID
|
||||||
GetTimestamp() time.Time
|
GetTimestamp() time.Time
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
_ "git.eeqj.de/sneak/go-simplelog" // Using underscore to only invoke init()
|
_ "sneak.berlin/go/simplelog" // Using underscore to only invoke init()
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Loading…
Reference in New Issue