Skip to content

Commit 7b6264a

Browse files
committed
FEAT: using system/options/log to specify system log verbosity in central place
(this is WIP as codecs and schemes are still using not centralized traces)
1 parent ebaa2c2 commit 7b6264a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/boot/sysobj.r

+9
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ options: context [ ; Options supplied to REBOL during startup
145145
default-suffix: %.reb ; Used by IMPORT if no suffix is provided
146146
file-types: []
147147
result-types: none
148+
149+
; verbosity of logs per service (codecs, schemes)
150+
; 0 = nothing; 1 = info; 2 = more; 3 = debug
151+
log: make object! [
152+
http:
153+
tls:
154+
zip:
155+
tar: 1
156+
]
148157
]
149158

150159
script: context [

src/mezz/sys-codec.r

+7-4
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,16 @@ log: func [
113113
/info
114114
/more
115115
/debug
116+
/local level
116117
][
118+
level: select system/options/log id
119+
if any [none? level level <= 0] [exit]
117120
if block? msg [msg: form reduce :msg]
118121
case [
119-
info [ print ajoin [" ^[[1;33m[" id "] ^[[36m" msg "^[[0m"]]
120-
more [ print ajoin [" ^[[33m[" id "] ^[[0;36m" msg "^[[0m"]]
121-
debug [ print ajoin [" ^[[33m[" id "] ^[[0;32m" msg "^[[0m"]]
122-
true [ print ajoin [" ^[[33m[" id "] " msg "^[[0m"]]
122+
info [ if level > 0 [print ajoin [" ^[[1;33m[" id "] ^[[36m" msg "^[[0m"]]]
123+
more [ if level > 1 [print ajoin [" ^[[33m[" id "] ^[[0;36m" msg "^[[0m"]]]
124+
debug [ if level > 2 [print ajoin [" ^[[33m[" id "] ^[[0;32m" msg "^[[0m"]]]
125+
true [ if level > 0 [print ajoin [" ^[[33m[" id "] " msg "^[[0m"]]]
123126
]
124127
]
125128

0 commit comments

Comments
 (0)