File tree 3 files changed +64
-7
lines changed
3 files changed +64
-7
lines changed Original file line number Diff line number Diff line change 5
5
[ ![ Build Status] ( https://github.com/c42f/TerminalLoggers.jl/workflows/CI/badge.svg )] ( https://github.com/c42f/TerminalLoggers.jl/actions?query=workflow%3ACI )
6
6
[ ![ Codecov] ( https://codecov.io/gh/c42f/TerminalLoggers.jl/branch/master/graph/badge.svg )] ( https://codecov.io/gh/c42f/TerminalLoggers.jl )
7
7
8
- ` TerminalLoggers ` contains user interface utilities for displaying log messages
9
- in text terminals.
8
+ TerminalLoggers provides a logger type ` TerminalLogger ` which can format your
9
+ log messages in a richer way than the default ` ConsoleLogger ` which comes with
10
+ the julia standard ` Logging ` library.
11
+
12
+ Read the [ documentation] ( https://c42f.github.io/TerminalLoggers.jl/stable ) for
13
+ more information.
Original file line number Diff line number Diff line change 1
1
# TerminalLoggers.jl
2
2
3
- ``` @index
3
+ TerminalLoggers provides a logger type [ ` TerminalLogger ` ] ( @ref ) which can
4
+ format your log messages in a richer way than the default ` ConsoleLogger ` which
5
+ comes with the julia standard ` Logging ` library.
6
+
7
+
8
+ ## Installation and setup
9
+
10
+ ``` julia-repl
11
+ pkg> add https://github.com/c42f/TerminalLoggers.jl
12
+ ```
13
+
14
+ To use ` TerminalLogger ` in all your REPL sessions by default, you may add a
15
+ snippet such as the following to your startup file (in ` .julia/config/startup.jl ` )
16
+
17
+ ``` julia
18
+ atreplinit () do repl
19
+ try
20
+ @eval begin
21
+ using Logging: global_logger
22
+ using TerminalLoggers: TerminalLogger
23
+ global_logger (TerminalLogger ())
24
+ end
25
+ catch
26
+ end
27
+ end
28
+ ```
29
+
30
+
31
+ ## Progress bars
32
+
33
+ ` TerminalLogger ` displays progress logging as a set of progress bars which are
34
+ cleanly separated from the rest of the program output at the bottom of the
35
+ terminal. Try an example like the following
36
+
37
+ ``` julia
38
+ global_logger (TerminalLogger (right_justify= 120 ))
39
+ for i= 1 : 100
40
+ if i == 50
41
+ @warn " Middle of computation" i
42
+ end
43
+ sleep (0.01 )
44
+ @info " Some progress" progress= i/ 100
45
+ end
46
+ @info " Done"
4
47
```
5
48
6
- ``` @autodocs
7
- Modules = [TerminalLoggers]
49
+ !!! note
50
+ Rendering progress bars separately doesn't yet work on windows due to
51
+ limitations of the windows console and its interaction with libuv.
52
+ We expect this will eventually be solved with some combination of libuv
53
+ updates and the new windows terminal.
54
+
55
+
56
+ ## API Reference
57
+
58
+ ``` @docs
59
+ TerminalLogger
8
60
```
Original file line number Diff line number Diff line change 2
2
TerminalLogger(stream=stderr, min_level=$ProgressLevel ; meta_formatter=default_metafmt,
3
3
show_limited=true, right_justify=0)
4
4
5
- Logger with formatting optimized for readability in a text console, for example
6
- interactive work with the Julia REPL.
5
+ Logger with formatting optimized for interactive readability in a text console
6
+ (for example, the Julia REPL). This is an enhanced version of the terminal
7
+ logger `Logging.ConsoleLogger` which comes installed with Julia by default.
7
8
8
9
Log levels less than `min_level` are filtered out.
9
10
You can’t perform that action at this time.
0 commit comments