better logging for compiling
This commit is contained in:
@@ -259,7 +259,6 @@ if (_native) {
|
||||
compile_native_cached(_te.name, core_path + '/' + _te.path)
|
||||
_ti = _ti + 1
|
||||
}
|
||||
os.print("bootstrap: native cache seeded\n")
|
||||
} else {
|
||||
// Bytecode path: seed cache with everything engine needs
|
||||
_targets = [
|
||||
@@ -276,5 +275,4 @@ if (_native) {
|
||||
compile_and_cache(_te.name, core_path + '/' + _te.path)
|
||||
_ti = _ti + 1
|
||||
}
|
||||
os.print("bootstrap: cache seeded\n")
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ function analyze(src, filename) {
|
||||
_i = 0
|
||||
while (_i < length(folded._diagnostics)) {
|
||||
e = folded._diagnostics[_i]
|
||||
os.print(`${filename}:${text(e.line)}:${text(e.col)}: ${e.severity}: ${e.message}\n`)
|
||||
log.warn(`${filename}:${text(e.line)}:${text(e.col)}: ${e.severity}: ${e.message}`)
|
||||
_i = _i + 1
|
||||
}
|
||||
if (_wm) {
|
||||
@@ -443,8 +443,12 @@ function run_ast_fn(name, ast, env, pkg) {
|
||||
_has_errors = false
|
||||
while (_di < length(optimized._diagnostics)) {
|
||||
_diag = optimized._diagnostics[_di]
|
||||
os.print(`${_diag.file}:${text(_diag.line)}:${text(_diag.col)}: ${_diag.severity}: ${_diag.message}\n`)
|
||||
if (_diag.severity == "error") _has_errors = true
|
||||
if (_diag.severity == "error") {
|
||||
log.error(`${_diag.file}:${text(_diag.line)}:${text(_diag.col)}: ${_diag.severity}: ${_diag.message}`)
|
||||
_has_errors = true
|
||||
} else {
|
||||
log.warn(`${_diag.file}:${text(_diag.line)}:${text(_diag.col)}: ${_diag.severity}: ${_diag.message}`)
|
||||
}
|
||||
_di = _di + 1
|
||||
}
|
||||
if (_has_errors) disrupt
|
||||
@@ -506,8 +510,12 @@ function compile_user_blob(name, ast, pkg) {
|
||||
_has_errors = false
|
||||
while (_di < length(optimized._diagnostics)) {
|
||||
_diag = optimized._diagnostics[_di]
|
||||
os.print(`${_diag.file}:${text(_diag.line)}:${text(_diag.col)}: ${_diag.severity}: ${_diag.message}\n`)
|
||||
if (_diag.severity == "error") _has_errors = true
|
||||
if (_diag.severity == "error") {
|
||||
log.error(`${_diag.file}:${text(_diag.line)}:${text(_diag.col)}: ${_diag.severity}: ${_diag.message}`)
|
||||
_has_errors = true
|
||||
} else {
|
||||
log.warn(`${_diag.file}:${text(_diag.line)}:${text(_diag.col)}: ${_diag.severity}: ${_diag.message}`)
|
||||
}
|
||||
_di = _di + 1
|
||||
}
|
||||
if (_has_errors) disrupt
|
||||
@@ -920,9 +928,8 @@ function load_log_config() {
|
||||
sink: {
|
||||
terminal: {
|
||||
type: "console",
|
||||
format: "pretty",
|
||||
channels: ["*"],
|
||||
exclude: ["system", "shop", "build"],
|
||||
format: "clean",
|
||||
channels: ["console", "error"],
|
||||
stack: ["error"]
|
||||
}
|
||||
}
|
||||
@@ -964,6 +971,25 @@ function bare_format(rec) {
|
||||
return out
|
||||
}
|
||||
|
||||
function clean_format(rec) {
|
||||
var ev = is_text(rec.event) ? rec.event : json.encode(rec.event, false)
|
||||
var out = null
|
||||
var i = 0
|
||||
var fr = null
|
||||
if (rec.channel == "error") {
|
||||
out = `error: ${ev}\n`
|
||||
} else {
|
||||
out = `${ev}\n`
|
||||
}
|
||||
if (rec.stack && length(rec.stack) > 0) {
|
||||
for (i = 0; i < length(rec.stack); i = i + 1) {
|
||||
fr = rec.stack[i]
|
||||
out = out + ` at ${fr.fn} (${fr.file}:${text(fr.line)}:${text(fr.col)})\n`
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
function sink_excluded(sink, channel) {
|
||||
var excluded = false
|
||||
if (!sink.exclude || length(sink.exclude) == 0) return false
|
||||
@@ -981,6 +1007,8 @@ function dispatch_to_sink(sink, rec) {
|
||||
os.print(json.encode(rec, false) + "\n")
|
||||
else if (sink.format == "bare")
|
||||
os.print(bare_format(rec))
|
||||
else if (sink.format == "clean")
|
||||
os.print(clean_format(rec))
|
||||
else
|
||||
os.print(pretty_format(rec))
|
||||
} else if (sink.type == "file") {
|
||||
|
||||
@@ -1882,6 +1882,7 @@ Shop.sync_with_deps = function(pkg, opts) {
|
||||
if (visited[current]) continue
|
||||
visited[current] = true
|
||||
|
||||
log.console(' Fetching ' + current + '...')
|
||||
Shop.sync(current, opts)
|
||||
|
||||
_read_deps = function() {
|
||||
@@ -2072,6 +2073,12 @@ Shop.build_package_scripts = function(package)
|
||||
_try()
|
||||
})
|
||||
|
||||
if (length(errors) > 0) {
|
||||
log.console(' Compiling scripts (' + text(ok) + ' ok, ' + text(length(errors)) + ' errors)')
|
||||
} else if (ok > 0) {
|
||||
log.console(' Compiling scripts (' + text(ok) + ' ok)')
|
||||
}
|
||||
|
||||
return {ok: ok, errors: errors, total: length(scripts)}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user