diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-21 21:11:49 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-21 21:32:16 +0100 |
commit | 7f66a4e3ba143ce984f52b63eb0e9d71d70fa20b (patch) | |
tree | b9fe8064984c0e6dcfe9e3adfac370c87f7294e3 /Userland/Libraries | |
parent | 0bb2729423d22760bdfc3ad80b294480408bebe2 (diff) | |
download | serenity-7f66a4e3ba143ce984f52b63eb0e9d71d70fa20b.zip |
LibJS: Print console.{debug,error,info,log,warn} to system debug log
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Console.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Console.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Console.cpp b/Userland/Libraries/LibJS/Console.cpp index 5d549d0c47..c4fe3590be 100644 --- a/Userland/Libraries/LibJS/Console.cpp +++ b/Userland/Libraries/LibJS/Console.cpp @@ -35,8 +35,14 @@ Console::Console(GlobalObject& global_object) { } +VM& Console::vm() +{ + return m_global_object.vm(); +} + Value Console::debug() { + dbgln("\033[32;1m(js debug)\033[0m {}", vm().join_arguments()); if (m_client) return m_client->debug(); return js_undefined(); @@ -44,6 +50,7 @@ Value Console::debug() Value Console::error() { + dbgln("\033[32;1m(js error)\033[0m {}", vm().join_arguments()); if (m_client) return m_client->error(); return js_undefined(); @@ -51,6 +58,7 @@ Value Console::error() Value Console::info() { + dbgln("\033[32;1m(js info)\033[0m {}", vm().join_arguments()); if (m_client) return m_client->info(); return js_undefined(); @@ -58,6 +66,7 @@ Value Console::info() Value Console::log() { + dbgln("\033[32;1m(js log)\033[0m {}", vm().join_arguments()); if (m_client) return m_client->log(); return js_undefined(); @@ -65,6 +74,7 @@ Value Console::log() Value Console::warn() { + dbgln("\033[32;1m(js warn)\033[0m {}", vm().join_arguments()); if (m_client) return m_client->warn(); return js_undefined(); diff --git a/Userland/Libraries/LibJS/Console.h b/Userland/Libraries/LibJS/Console.h index d8d96be85c..0782ddf14d 100644 --- a/Userland/Libraries/LibJS/Console.h +++ b/Userland/Libraries/LibJS/Console.h @@ -47,6 +47,8 @@ public: GlobalObject& global_object() { return m_global_object; } const GlobalObject& global_object() const { return m_global_object; } + VM& vm(); + HashMap<String, unsigned>& counters() { return m_counters; } const HashMap<String, unsigned>& counters() const { return m_counters; } |