# HG changeset patch # User Dmitry Volyntsev # Date 1522332091 -10800 # Node ID 3882f8f3b2bcdc1c45b0f37dc0ce2eb109133bb7 # Parent 3eb1de7e3b414b396eb5cc07567a8448ca9d0d40 Tests: added njs extended logging tests. diff --git a/js.t b/js.t --- a/js.t +++ b/js.t @@ -178,7 +178,9 @@ EOF } function test_log(req, res) { - req.log("SEE-THIS"); + req.log("SEE-THIS-LOG"); + req.warn("SEE-THIS-WARN"); + req.error("SEE-THIS-ERROR"); } function test_except(req, res) { @@ -261,7 +263,7 @@ EOF EOF -$t->try_run('no njs available')->plan(22); +$t->try_run('no njs available')->plan(24); ############################################################################### @@ -302,7 +304,9 @@ like(http_get('/res_ihdr'), qr/\x0d\x0a? $t->stop(); -ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'log js'); +ok(index($t->read_file('error.log'), 'SEE-THIS-LOG') > 0, 'log js'); +ok(index($t->read_file('error.log'), 'SEE-THIS-WARN') > 0, 'warn js'); +ok(index($t->read_file('error.log'), 'SEE-THIS-ERROR') > 0, 'error js'); ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, 'js_set backtrace'); ok(index($t->read_file('error.log'), 'at JSON.parse') > 0, diff --git a/stream_js.t b/stream_js.t --- a/stream_js.t +++ b/stream_js.t @@ -133,7 +133,9 @@ EOF } function js_log(sess) { - sess.log("SEE-THIS"); + sess.log("SEE-THIS-LOG"); + sess.warn("SEE-THIS-WARN"); + sess.error("SEE-THIS-ERROR"); } function js_access_allow(sess) { @@ -199,7 +201,7 @@ EOF EOF $t->run_daemon(\&stream_daemon, port(8090)); -$t->try_run('no stream njs available')->plan(14); +$t->try_run('no stream njs available')->plan(16); $t->waitforsocket('127.0.0.1:' . port(8090)); ############################################################################### @@ -223,7 +225,9 @@ stream('127.0.0.1:' . port(8093))->io('x $t->stop(); -ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'stream js log'); +ok(index($t->read_file('error.log'), 'SEE-THIS-LOG') > 0, 'stream js log'); +ok(index($t->read_file('error.log'), 'SEE-THIS-WARN') > 0, 'stream js warn'); +ok(index($t->read_file('error.log'), 'SEE-THIS-ERROR') > 0, 'stream js error'); ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, 'stream js_preread backtrace'); ok(index($t->read_file('error.log'), 'at js_filter_except') > 0,