Skip to content

Commit f1cc38d

Browse files
committed
Add TUI to the README and some updates
1 parent fdda3d7 commit f1cc38d

1 file changed

Lines changed: 25 additions & 12 deletions

File tree

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,25 @@ Logger.configure_backend(RingLogger, max_size: 1024)
8383
See the example project for a hands-on walk-through of using the logger. Read on
8484
for the highlights.
8585

86-
Log messages aren't printed to the console by default. If you're seeing them,
87-
they may be coming from Elixir's default `:console` logger.
86+
For the purpose of the example, when you're in IEx, log messages shouldn't be
87+
printed to the console by default. They'll be coming from the console logger, so
88+
turn them off:
8889

89-
To see log messages as they come in, call `RingLogger.attach()` and then to make
90-
the log messages stop, call `RingLogger.detach()`. The `attach` method takes
91-
options if you want to limit the log level, change the formatting, etc.
90+
```elixir
91+
iex> Logger.remove_backend(:console)
92+
:ok
93+
```
94+
95+
To see log messages as they come in with RingLogger, call `RingLogger.attach()`
96+
and then to make the log messages stop, call `RingLogger.detach()`. The `attach`
97+
method takes options if you want to limit the log level, change the formatting,
98+
etc.
9299

93100
Here's an example:
94101

95102
```elixir
96103
iex> Logger.add_backend(RingLogger)
97104
{:ok, #PID<0.199.0>}
98-
iex> Logger.remove_backend(:console)
99-
:ok
100105
iex> RingLogger.attach
101106
:ok
102107
iex> require Logger
@@ -106,11 +111,8 @@ iex> Logger.info("hello")
106111
14:04:52.516 [info] hello
107112
```
108113

109-
This probably isn't too exciting until you see that it works on remote shells as
110-
well (the `:console` logger doesn't do this).
111-
112-
Say you prefer polling for log messages rather than having them print over your
113-
console at random times. If you're still attached, then `detach` and `next`:
114+
If you prefer polling for log messages rather than having them print when they
115+
show up. If you're still attached, then `detach` and `next`:
114116

115117
```elixir
116118
iex> RingLogger.detach
@@ -152,6 +154,17 @@ iex> RingLogger.grep(~r/[Nn]eedle/)
152154
16:55:41.614 [info] Needle in a haystack
153155
```
154156

157+
## RingLogger TUI
158+
159+
RingLogger provides a simple text UI that lets you access log viewing features
160+
in a friendly way.
161+
162+
```elixir
163+
iex> RingLogger.viewer()
164+
```
165+
166+
Type `h` and then enter for help.
167+
155168
## Module and Application Level Filtering
156169

157170
If you want to filter a module or modules at a particular level you pass a map

0 commit comments

Comments
 (0)