Skip to content

Commit 181f6c6

Browse files
author
Russ Egan
committed
Added readmes
1 parent 6df0a78 commit 181f6c6

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
flume [![GoDoc](https://godoc.org/github.com/gemalto/flume?status.png)](https://godoc.org/github.com/gemalto/flume) [![Go Report Card](https://goreportcard.com/badge/github.com/gemalto/flume)](https://goreportcard.com/report/gemalto/flume) [![Build](https://github.com/gemalto/flume/workflows/Build/badge.svg)](https://github.com/gemalto/flume/actions?query=branch%3Amaster+workflow%3ABuild+)
22
=====
33

4+
> ### [Flume v2](https://github.com/ThalesGroup/flume/tree/master/v2) is near release. This is a ground up rewrite of flume as a slog.Handler.
5+
> v1 will continue to be supported, but new applications should consider slog and v2.
6+
47
flume is a logging package, build on top of [zap](https://github.com/uber-go/zap). It's structured and leveled logs, like zap/logrus/etc.
58
It adds a global registry of all loggers, allowing global re-configuration at runtime. Instantiating
69
new loggers automatically registers them: even loggers created in init() functions, package variable

v2/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Flume [![GoDoc](https://godoc.org/github.com/ThalesGroup/flume?status.png)](https://godoc.org/github.com/ThalesGroup/flume/v2) [![Go Report Card](https://goreportcard.com/badge/github.com/ThalesGroup/flume)](https://goreportcard.com/report/ThalesGroup/flume) [![Build](https://github.com/ThalesGroup/flume/workflows/Build/badge.svg)](https://github.com/ThalesGroup/flume/actions?query=branch%3Amaster+workflow%3ABuild+)
2+
=====
3+
4+
Flume is a handler for the log/slog package. A flume handler has a couple nifty capabilities:
5+
6+
- It enables different levels based on the value of a special `logger` attribute in the record.
7+
For example, the default level might be INFO, but records with the attribute `logger=http` can be enabled at the debug level. (The attribute name is configurable).
8+
- Flume handlers forward records to another, "sink" Handler. The sink can be changed at runtime,
9+
in an atomic, concurrency-safe way, even after loggers are created and while they are being used.
10+
So you can switch from text to json at runtime without re-creating loggers, enable/disable the source
11+
attribute, or add/remove ReplaceAttr functions.
12+
- Middleware: you can configure Handler middleware, which can do things like augmenting
13+
log records with additional attributes from the context. As with the sink handler, middleware
14+
can be added or swapped at runtime.
15+
- Flume's HandlerOptions can be configured from a JSON configuration spec, and has convenience
16+
methods for reading this configuration from environment variables.
17+
- Integrates with [github.com/ansel1/console-slog](https://github.com/ansel1/console-slog), providing
18+
a very human-friendly output format
19+
20+
Migration from v1
21+
-----------------
22+
23+
Flume v1 was based on zap internally, but its logging functions (e.g. `log.Info()`) had the same signatures as `slog.Logger`.
24+
25+
Migration steps:
26+
27+
- Replace flume imports with flume/v2
28+
- Replace `flume.New(` with `flume.New(` (or with calls to `slog.New()` passing a flume/v2 handler)
29+
- Replace `.IsDebug()` with `.Enabled(ctx, slog.LevelDebug)`
30+
- Compiler errors: fix unmatched arguments to logging function (e.g. `l.Info("temp", temp)` -> `l.Info("temp", "value", temp)`
31+
- Consider [zap2slog](https://github.com/ansel1/zap2slog) to do the transition incrementally
32+
33+
Contributing
34+
------------
35+
36+
To build, be sure to have a recent go SDK, golangci-lint, and [just](https://github.com/casey/just). Then run `just`.
37+
38+
Merge requests are welcome!

0 commit comments

Comments
 (0)