File tree 3 files changed +40
-26
lines changed
3 files changed +40
-26
lines changed Original file line number Diff line number Diff line change @@ -152,12 +152,12 @@ options: object [ ; Options supplied to REBOL during startup
152
152
153
153
; verbosity of logs per service (codecs, schemes)
154
154
; 0 = nothing; 1 = info; 2 = more; 3 = debug
155
- log: construct [
156
- http:
157
- tls:
158
- zip:
159
- tar: 1
160
- ]
155
+ log: #[map! [
156
+ http: 1
157
+ tls: 1
158
+ zip: 1
159
+ tar: 1
160
+ ]]
161
161
]
162
162
163
163
script: construct [
Original file line number Diff line number Diff line change @@ -224,3 +224,37 @@ assert-utf8: function [
224
224
]
225
225
data
226
226
]
227
+
228
+ log : func [
229
+ "Prints out debug message"
230
+ id [word! ] "Source of the log message"
231
+ msg "Output message"
232
+ /info
233
+ /more
234
+ /debug
235
+ /error
236
+ /local level
237
+ ] [
238
+ if error [
239
+ msg: form either block? msg [reduce msg][msg]
240
+ foreach line parse/all msg #"^/" [
241
+ print ajoin [
242
+ " ^[ [35m[" id "] ^[ [1m"
243
+ either line/1 = #"*" []["** Error: " ]
244
+ copy/part line 100
245
+ "^[ [0m"
246
+ ]
247
+ ]
248
+ exit
249
+ ]
250
+ if system/options/quiet [exit]
251
+ level: select system/options/log id
252
+ if any [none? level level <= 0 ] [exit]
253
+ if block? msg [msg: form reduce :msg ]
254
+ case [
255
+ info [ if level > 0 [print ajoin [" ^[ [1;33m[" id "] ^[ [36m" msg "^[ [0m" ]]]
256
+ more [ if level > 1 [print ajoin [" ^[ [33m[" id "] ^[ [0;36m" msg "^[ [0m" ]]]
257
+ debug [ if level > 2 [print ajoin [" ^[ [33m[" id "] ^[ [0;32m" msg "^[ [0m" ]]]
258
+ true [ if level > 0 [print ajoin [" ^[ [33m[" id "] " msg "^[ [0m" ]]]
259
+ ]
260
+ ]
Original file line number Diff line number Diff line change @@ -113,24 +113,4 @@ encoding?: function [
113
113
none
114
114
]
115
115
116
- log : func [
117
- "Prints out debug message"
118
- id [word! ] "Source of the log message"
119
- msg "Output message"
120
- /info
121
- /more
122
- /debug
123
- /local level
124
- ] [
125
- level: select system/options/log id
126
- if any [none? level level <= 0 ] [exit]
127
- if block? msg [msg: form reduce :msg ]
128
- case [
129
- info [ if level > 0 [print ajoin [" ^[ [1;33m[" id "] ^[ [36m" msg "^[ [0m" ]]]
130
- more [ if level > 1 [print ajoin [" ^[ [33m[" id "] ^[ [0;36m" msg "^[ [0m" ]]]
131
- debug [ if level > 2 [print ajoin [" ^[ [33m[" id "] ^[ [0;32m" msg "^[ [0m" ]]]
132
- true [ if level > 0 [print ajoin [" ^[ [33m[" id "] " msg "^[ [0m" ]]]
133
- ]
134
- ]
135
-
136
116
export [register-codec decode encode encoding?]
You can’t perform that action at this time.
0 commit comments