Skip to content

Commit c8a5936

Browse files
committed
CHANGE: replaced internal boot-print and loud-print functions with system log calls
resolves: Oldes/Rebol-issues#1920
1 parent 14a003d commit c8a5936

8 files changed

+38
-47
lines changed

src/boot/sysobj.reb

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ options: object [ ; Options supplied to REBOL during startup
158158
; verbosity of logs per service (codecs, schemes)
159159
; 0 = nothing; 1 = info; 2 = more; 3 = debug
160160
log: #[map! [
161+
rebol: 1
161162
http: 1
162163
tls: 1
163164
zip: 1

src/mezz/base-debug.reb

-14
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,3 @@ probe: func [
6161
]
6262
exit
6363
]
64-
65-
boot-print: func [
66-
"Prints when not quiet."
67-
data
68-
][
69-
unless system/options/quiet [print :data]
70-
]
71-
72-
loud-print: func [
73-
"Prints when verbose."
74-
data
75-
][
76-
if system/options/flags/verbose [print :data]
77-
]

src/mezz/base-funcs.reb

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ unset 'action ; this native was only for internal use, co unset it now!
117117
unset 'native ; no crash, but not useful -> https://github.com/Oldes/Rebol-issues/issues/918
118118

119119

120-
;secure: func ['d] [boot-print "SECURE is disabled"]
120+
;secure: func ['d] [print "SECURE is disabled"]
121121

src/mezz/mezz-banner.reb

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ system/license: make-banner [
8282
]
8383

8484

85-
sys/boot-help:
86-
{^[[1;33mImportant notes^[[0m:
85+
append sys/boot-banner
86+
{^/^[[1;33mImportant notes^[[0m:
8787
8888
* Sandbox and security are not fully available.
8989
* Direct access to TCP HTTP required (no proxies).

src/mezz/sys-base.reb

+7-6
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ do*: func [
7878
]
7979

8080
; Print out the script info
81-
boot-print [
82-
pick ["Module:" "Script:"] mod? mold select hdr 'title
83-
"Version:" select hdr 'version
84-
"Date:" select hdr 'date
81+
log/info 'REBOL [
82+
pick ["Module:" "Script:"] mod?
83+
mold select hdr 'title
84+
"Version:" any [select hdr 'version '_]
85+
"Date:" any [select hdr 'date '_]
8586
]
8687

8788
set/any 'value try [
@@ -247,8 +248,8 @@ log: func [
247248
exit
248249
]
249250
if system/options/quiet [exit]
250-
level: select system/options/log id
251-
if any [none? level level <= 0] [exit]
251+
level: any [select system/options/log id 3]
252+
if level <= 0 [exit]
252253
if block? msg [msg: form reduce :msg]
253254
case [
254255
info [ if level > 0 [print ajoin [" ^[[1;33m[" id "] ^[[36m" msg "^[[0m"]]]

src/mezz/sys-load.reb

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ load-ext-module: function [
188188
]
189189
;assert/type [hdr object! hdr/options [block! none!] code [binary! block!]]
190190

191-
loud-print ["Extension:" select hdr 'title]
191+
log/debug 'REBOL ["Extension:" select hdr 'title]
192192
unless hdr/options [hdr/options: make block! 1]
193193
append hdr/options 'extension ; So make module! special cases it
194194
hdr/type: 'module ; So load and do special case it
@@ -220,7 +220,7 @@ load-ext-module: function [
220220
load-boot-exts: function [
221221
"INIT: Load boot-based extensions."
222222
][
223-
loud-print "Loading boot extensions..."
223+
log/debug 'REBOL "Loading boot extensions..."
224224

225225
ext-objs: []
226226

src/mezz/sys-ports.reb

+3-3
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ make-scheme: func [
166166
init-schemes: func [
167167
"INIT: Init system native schemes and ports."
168168
][
169-
loud-print "Init schemes"
169+
log/debug 'REBOL "Init schemes"
170170

171171
sys/decode-url: lib/decode-url: :sys/*parse-url/decode-url
172172

173173
system/schemes: make object! 11
174174

175175
make-scheme [
176176
title: "System Port"
177-
name: 'system
177+
name: 'REBOL
178178
awake: func [
179179
sport "System port (State block holds events)"
180180
ports "Port list (Copy of block passed to WAIT)"
@@ -357,7 +357,7 @@ init-schemes: func [
357357
]
358358
]
359359

360-
system/ports/system: open [scheme: 'system]
360+
system/ports/system: open [scheme: 'REBOL]
361361
system/ports/input: open [scheme: 'console]
362362
system/ports/callback: open [scheme: 'callback]
363363

src/mezz/sys-start.reb

+22-19
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ start: func [
2525
;** Note ** We need to make this work for lower boot levels too!
2626

2727
;-- DEBUG: enable these lines for debug or related testing
28-
loud-print ["Starting... boot level:" boot-level]
28+
log/debug 'REBOL ["Starting... boot level:" boot-level]
2929
;trace 1
3030
;crash-here ; test error handling (undefined word)
3131

@@ -41,19 +41,23 @@ start: func [
4141
system/build/compiler: ver/6
4242
system/build/date: ver/7
4343

44+
if flags/verbose [system/options/log/rebol: 3] ;maximum log output for system messages
45+
4446
;-- Print minimal identification banner if needed:
4547
if all [
4648
not quiet
4749
any [flags/verbose flags/usage flags/help]
4850
][
49-
boot-print boot-banner ; basic boot banner only
51+
; basic boot banner only
52+
prin "^/ "
53+
print boot-banner: form ver
5054
]
5155
if any [do-arg script] [quiet: true]
5256

5357
;-- Set up option/paths for /path, /boot, /home, and script path (for SECURE):
54-
loud-print ["Initial path:" path]
55-
loud-print ["Initial boot:" boot]
56-
loud-print ["Initial home:" home] ; always NONE at this state!
58+
log/more 'REBOL ["Initial path:" path]
59+
log/more 'REBOL ["Initial boot:" boot]
60+
;log/more 'REBOL ["Initial home:" home] ; always NONE at this state!
5761
;- 1. /path - that is current directory (resolved from C as a part of args processing)
5862
; nothing to do here
5963
;- 2. /boot - path to executable (must handle relative paths)
@@ -69,7 +73,7 @@ start: func [
6973
]
7074
]
7175
if boot <> tmp [
72-
loud-print "Path to executable was not resolved!"
76+
log/error 'REBOL "Path to executable was not resolved!"
7377
boot: none
7478
]
7579
]
@@ -110,7 +114,7 @@ start: func [
110114
; For example: mods, plus, host, and full
111115
if boot-level [
112116
load-boot-exts
113-
loud-print "Init mezz plus..."
117+
log/debug 'REBOL "Init mezz plus..."
114118

115119
do bind-lib boot-mezz
116120
boot-mezz: 'done
@@ -128,7 +132,7 @@ start: func [
128132
]
129133

130134
if boot-host [
131-
loud-print "Init host code..."
135+
log/debug 'REBOL "Init host code..."
132136
;probe load boot-host
133137
do load boot-host
134138
boot-host: none
@@ -138,7 +142,7 @@ start: func [
138142
flags/verbose
139143
not any [quiet script do-arg]
140144
][
141-
boot-print boot-banner
145+
print boot-banner
142146
]
143147
]
144148

@@ -163,24 +167,25 @@ start: func [
163167
;-- Evaluate rebol.reb script:
164168
;@@ https://github.com/Oldes/Rebol-issues/issues/706
165169
tmp: first split-path boot
166-
loud-print ["Checking for rebol.reb file in" tmp]
170+
log/info 'REBOL ["Checking for rebol.reb file in" tmp]
167171

168172
if all [
169173
#"/" = first tmp ; only if we know absolute path
170174
exists? tmp/rebol.reb
171175
][
172-
do tmp/rebol.reb
176+
try/except [do tmp/rebol.reb][log/error 'REBOL system/state/last-error]
173177
]
174178

175179
;-- Make the user's global context:
176180
tmp: make object! 320
177-
append tmp reduce ['system :system 'lib-local :tmp]
181+
append tmp reduce ['REBOL :system 'lib-local :tmp]
178182
system/contexts/user: tmp
179183

180-
loud-print ["Checking for user.reb file in" home]
181-
if exists? home/user.reb [do home/user.reb]
184+
log/info 'REBOL ["Checking for user.reb file in" home]
185+
if exists? home/user.reb [
186+
try/except [do home/user.reb][log/error 'REBOL system/state/last-error]
187+
]
182188

183-
boot-print ""
184189

185190
;if :lib/secure [protect-system-object]
186191

@@ -194,7 +199,7 @@ start: func [
194199
]
195200

196201
;-- Evaluate script argument?
197-
either file? script [
202+
if file? script [
198203
; !!! Would be nice to use DO for this section. !!!
199204
; NOTE: We can't use DO here because it calls the code it does with CATCH/quit
200205
; and we shouldn't catch QUIT in the top-level script, we should just quit.
@@ -203,7 +208,7 @@ start: func [
203208
; /path dir is where our script gets started.
204209
change-dir first script-path
205210
either exists? second script-path [
206-
boot-print ["Evaluating:" script]
211+
log/info 'REBOL ["Evaluating:" script]
207212
code: load/header/type second script-path 'unbound
208213
; update system/script (Make into a function?)
209214
system/script: make system/standard/script [
@@ -225,8 +230,6 @@ start: func [
225230
] [
226231
cause-error 'access 'no-script script
227232
]
228-
][
229-
boot-print boot-help
230233
]
231234

232235
exit

0 commit comments

Comments
 (0)