Skip to content

Commit 91dc007

Browse files
authored
Merge pull request #21 from oxinabox/ox/syntaxhighlight
add syntax highlighting
2 parents cb19b17 + 209950d commit 91dc007

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LoggingExtras is designs around allowing you to build arbitrarily complicated
1212
systems for "log plumbing". That is to say basically routing logged information to different places.
1313
It is built around the idea of simple parts which are composed together,
1414
to allow for powerful and flexible definition of your logging system.
15-
Without having to define any custom loggers by subtyping `AbstractLogger`.
15+
Without you having to define any custom loggers by subtyping `AbstractLogger`.
1616
When we talk about composability we mean to say that the composition of any set of Loggers is itself a Logger.
1717
LoggingExtras is a composable logging system.
1818

@@ -37,7 +37,7 @@ and it has a min_enabled_level setting, that controls if it will accept a messag
3737
(Early Filtering, in particular see `MinLevelLogger`).
3838
If it was to be defined in a compositional way,
3939
we would write something along the lines of:
40-
```
40+
```julia
4141
ConsoleLogger(stream, min_level) =
4242
MinLevelLogger(
4343
ActiveFilteredLogger(max_log_filter,
@@ -58,19 +58,19 @@ Loggers can be constructed and used like normal.
5858
For full details, see the [Julia documentation on Logging](https://docs.julialang.org/en/v1/stdlib/Logging/index.html)
5959

6060
To use a `logger` in a given scope do
61-
```
61+
```julia
6262
with_logger(logger) do
6363
#things
6464
end
6565
```
6666

6767
To make a logger the global logger, use
68-
```
68+
```julia
6969
global_logger(logger)
7070
```
7171

7272
to get the current global logger, use
73-
```
73+
```julia
7474
logger = global_logger()
7575
```
7676

@@ -115,7 +115,7 @@ The resulting file format is similar to that which is shown in the REPL.
115115
We are going to log info and above to one file,
116116
and warnings and above to another.
117117

118-
```
118+
```julia
119119
julia> using Logging; using LoggingExtras;
120120

121121
julia> demux_logger = DemuxLogger(
@@ -158,7 +158,7 @@ The filter function takes the full set of parameters of the message.
158158
### Demo
159159
We want to filter to only log strings staring with `"Yo Dawg!"`.
160160

161-
```
161+
```julia
162162
julia> function yodawg_filter(log_args)
163163
startswith(log_args.message, "Yo Dawg!")
164164
end
@@ -191,7 +191,7 @@ see the HTTP example below.
191191
192192
Another example is using them to stop messages every being repeated within a given time period.
193193
194-
```
194+
```julia
195195
using Dates, Logging, LoggingExtras
196196

197197
julia> function make_throttled_logger(period)
@@ -243,7 +243,7 @@ and should return a new modified named tuple.
243243
244244
A simple example of its use is truncating messages.
245245
246-
```
246+
```julia
247247
julia> using Logging, LoggingExtras
248248

249249
julia> truncating_logger = TransformerLogger(global_logger()) do log
@@ -273,7 +273,7 @@ for example to set them all to the same `group`.
273273
274274
## Filter out any overly long messages
275275
276-
```
276+
```julia
277277
using LoggingExtras
278278
using Logging
279279

@@ -287,7 +287,7 @@ global_logger(ActiveFilteredLogger(sensible_message_filter, global_logger()))
287287
288288
## Filterout any messages from HTTP
289289
290-
```
290+
```julia
291291
using LoggingExtras
292292
using Logging
293293
using HTTP
@@ -301,7 +301,7 @@ global_logger(EarlyFilteredLogger(not_HTTP_message_filter, global_logger()))
301301
302302
## Raising HTTP debug level errors to be Info level
303303
304-
```
304+
```julia
305305
using LoggingExtras
306306
using Logging
307307
using HTTP

0 commit comments

Comments
 (0)