Deprecate log and logError in favor of console
Follow up from !792 (comment 1528290)
EDIT: I made a separate issue for improving console
output #511 (closed)
We should deprecate log
and logError
in favor of console.log
and console.error
.
However, for that to happen, we should make console
a bit smarter with objects so that it can log the type/gtype.
$ gjs
gjs> log(imports.gi.GLib)
Gjs-Message: 19:31:18.480: JS LOG: [object GIRepositoryNamespace]
$ gjs
gjs> console.log(imports.gi.GLib)
resource:///org/gnome/gjs/modules/esm/console.js:66:17 Error: Unions must currently be registered as boxed types
formatOptimally@resource:///org/gnome/gjs/modules/esm/console.js:66:17
output<@resource:///org/gnome/gjs/modules/esm/console.js:598:28
[Printer]@resource:///org/gnome/gjs/modules/esm/console.js:594:14
[Logger]@resource:///org/gnome/gjs/modules/esm/console.js:447:20
log@resource:///org/gnome/gjs/modules/esm/console.js:192:22
@typein:2:9
@<stdin>:1:42
$ node
> console.log(new TextDecoder())
TextDecoder { encoding: 'utf-8', fatal: false, ignoreBOM: false }
$ gjs
gjs> console.log(new TextDecoder())
Gjs-Console-Message: 19:36:53.017: {
"encoding": "utf-8",
"ignoreBOM": false,
"fatal": false
}
Edited by Sonny Piers