Skip to content

Commit 2d46dd3

Browse files
authored
Update docs + bump version to 0.1.1 (#24)
1 parent a7ee26e commit 2d46dd3

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TerminalLoggers"
22
uuid = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
33
authors = ["Chris Foster <[email protected]>"]
4-
version = "0.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
LeftChildRightSiblingTrees = "1d6d02ad-be62-4b6b-8a6d-2f90e265016e"

docs/src/index.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,45 @@ atreplinit() do repl
2727
end
2828
```
2929

30+
## Markdown
31+
32+
`TerminalLogger` interprets all `AbstractString` log messages as markdown so
33+
you can use markdown formatting to display readable formatted messages. For
34+
example,
35+
36+
```
37+
@info """
38+
# A heading
39+
40+
About to do the following
41+
42+
* A list
43+
* Of actions
44+
* To take
45+
"""
46+
```
3047

3148
## Progress bars
3249

3350
`TerminalLogger` displays progress logging as a set of progress bars which are
3451
cleanly separated from the rest of the program output at the bottom of the
35-
terminal. Try an example like the following
52+
terminal.
53+
54+
For robust progress logging, `TerminalLoggers` recognizes the `Progress` type
55+
from the [`ProgressLogging` package](https://junolab.org/ProgressLogging.jl/stable/).
56+
For easy to use progress reporting you can therefore use the `@progress` macro:
3657

3758
```julia
3859
global_logger(TerminalLogger(right_justify=120))
39-
for i=1:100
60+
using ProgressLogging
61+
62+
@progress for i=1:100
4063
if i == 50
41-
@warn "Middle of computation" i
64+
@info "Middle of computation" i
65+
elseif i == 70
66+
println("Normal output does not interfere with progress bars")
4267
end
4368
sleep(0.01)
44-
@info "Some progress" progress=i/100
4569
end
4670
@info "Done"
4771
```
@@ -52,6 +76,9 @@ end
5276
We expect this will eventually be solved with some combination of libuv
5377
updates and the new windows terminal.
5478

79+
You can also use the older progress logging API with the `progress=fraction`
80+
key value pair. This is simpler but has some downsides such as not interacting
81+
correctly with exceptions.
5582

5683
## API Reference
5784

0 commit comments

Comments
 (0)