-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a small intro/installation section; document progress logging and the exported API. Co-authored-by: Takafumi Arakaki <[email protected]>
- Loading branch information
Showing
3 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,60 @@ | ||
# TerminalLoggers.jl | ||
|
||
```@index | ||
TerminalLoggers provides a logger type [`TerminalLogger`](@ref) which can | ||
format your log messages in a richer way than the default `ConsoleLogger` which | ||
comes with the julia standard `Logging` library. | ||
|
||
|
||
## Installation and setup | ||
|
||
```julia-repl | ||
pkg> add https://github.com/c42f/TerminalLoggers.jl | ||
``` | ||
|
||
To use `TerminalLogger` in all your REPL sessions by default, you may add a | ||
snippet such as the following to your startup file (in `.julia/config/startup.jl`) | ||
|
||
```julia | ||
atreplinit() do repl | ||
try | ||
@eval begin | ||
using Logging: global_logger | ||
using TerminalLoggers: TerminalLogger | ||
global_logger(TerminalLogger()) | ||
end | ||
catch | ||
end | ||
end | ||
``` | ||
|
||
|
||
## Progress bars | ||
|
||
`TerminalLogger` displays progress logging as a set of progress bars which are | ||
cleanly separated from the rest of the program output at the bottom of the | ||
terminal. Try an example like the following | ||
|
||
```julia | ||
global_logger(TerminalLogger(right_justify=120)) | ||
for i=1:100 | ||
if i == 50 | ||
@warn "Middle of computation" i | ||
end | ||
sleep(0.01) | ||
@info "Some progress" progress=i/100 | ||
end | ||
@info "Done" | ||
``` | ||
|
||
```@autodocs | ||
Modules = [TerminalLoggers] | ||
!!! note | ||
Rendering progress bars separately doesn't yet work on windows due to | ||
limitations of the windows console and its interaction with libuv. | ||
We expect this will eventually be solved with some combination of libuv | ||
updates and the new windows terminal. | ||
|
||
|
||
## API Reference | ||
|
||
```@docs | ||
TerminalLogger | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4c97c23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
4c97c23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/8908
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via: