22
33[ ![ Build Status] ( https://travis-ci.org/colinfang/MiniLogging.jl.svg?branch=master )] ( https://travis-ci.org/colinfang/MiniLogging.jl )
44
5+ # Note
6+
7+ - v0.1 is last release that supports Julia v0.6.
8+ - Users have to explicitly export logging macros because they are already used by ` Base ` .
9+ ``` julia
10+ using MiniLogging
11+ # Explicitly shadow Base
12+ using MiniLogging: @debug, @info, @warn, @error, @critical
13+ ```
514# # Overview
615
716This is a Julia equivalent of Python logging package. It provides a basic hierarchical logging system.
@@ -16,7 +25,7 @@ When dealing with multiple nested modules, the experience with the existing Juli
1625## Features
1726
1827- The logger hierarchy is defined by the logger name, which is a dot-separated string (e.g. `"a.b"`).
19- - Simply use ` get_logger(current_module() ) ` to maintain a hierarchy.
28+ - Simply use `get_logger(@__MODULE__ )` to maintain a hierarchy.
2029- All loggers inherit settings from their ancestors up to the root by default.
2130 - Most of the time it is sufficient to set the root logger config only.
2231- Colors & logging levels are customizable.
@@ -32,6 +41,7 @@ export @debug, @info, @warn, @error, @critical
3241
3342```julia
3443julia> using MiniLogging
44+ julia> using MiniLogging: @debug, @info, @warn, @error, @critical
3545
3646# Get root logger.
3747# Nothing appears as we haven' t set any config on any loggers.
@@ -91,10 +101,10 @@ julia> @debug(logger2, "Hello", " world")
91101 - Log to ` file_name ` .
92102
93103``` julia
94- # Log to both `STDERR` & `foo` .
104+ # Log to both `STDERR` & a file .
95105basic_config(MiniLogging. INFO, " foo" )
96106root_logger = get_logger()
97- push!(root_logger. handlers, MiniLogging. Handler(STDERR , " %Y-%m-%d %H:%M:%S”))
107+ push!(root_logger. handlers, MiniLogging. Handler(stderr , " %Y-%m-%d %H:%M:%S”))
98108```
99109
100110
0 commit comments