@@ -30,6 +30,15 @@ where you would typically write `puts …` or `pp …`, but with a few extras.
3030
31312. Run ` shards install`
3232
33+ 3. Make sure you compile your program with ENV variable `DEBUG` set to `1`
34+ (for instance `DEBUG=1 shards build`). Otherwise all `debug!(…)` calls
35+ will become a no-op.
36+
37+ 4. Once your program is compiled, you need to pass `DEBUG=1` again on the
38+ program start, in order to activate `debug!(…)` logging. Alternatively,
39+ you can call `Debug.enabled = true` within your code to achieve the same
40+ behaviour.
41+
3342# # Usage
3443
3544` ` ` crystal
@@ -61,14 +70,6 @@ The code above produces this output:
6170
6271## Configuration
6372
64- - Make sure you compile your program with ENV variable ` DEBUG ` set to ` 1 `
65- (for instance ` DEBUG=1 shards build ` ). Otherwise all ` debug!(…) ` calls
66- will become a no-op.
67- - Once your program is compiled, you need to pass ` DEBUG=1 ` again on the
68- program start, in order to activate ` debug!(…) ` logging. Alternatively,
69- you can call ` Debug.enabled = true ` within your code to achieve the same
70- behaviour.
71-
7273You can change the global defaults by calling ` Debug.configure ` with a block:
7374
7475``` crystal
@@ -85,8 +86,11 @@ global defaults related to the logging itself.
8586
8687``` crystal
8788Debug::Logger.configure do |settings|
89+ settings.progname = "foo.cr"
90+
8891 settings.show_severity = false
8992 settings.show_datetime = true
93+ settings.show_progname = true
9094
9195 settings.colors[:datetime] = :dark_gray
9296 settings.colors[:progname] = :light_blue
0 commit comments