diff --git a/packages/core/lib/plugins/metadata/debug.js b/packages/core/lib/plugins/metadata/debug.js index f7a55c4e7..704dd4f1d 100644 --- a/packages/core/lib/plugins/metadata/debug.js +++ b/packages/core/lib/plugins/metadata/debug.js @@ -70,9 +70,10 @@ export default { : log.message?.toString != null ? log.message.toString().trim() : JSON.stringify(log.message); + const type = log.type.split('_')[0]; const position = log.position.map((i) => i + 1).join('.'); const name = log.namespace?.join('.') || log.module; - msg = ['[', position + '.' + log.level, name ? ' ' + name : void 0, '] ', msg].join(''); + msg = ['[', type, ' ', position + ' ' + log.level, name ? ' ' + name : void 0, '] ', msg].join(''); msg = (function() { switch (log.type) { case 'stdin': diff --git a/packages/core/test/plugins/metadata/debug.coffee b/packages/core/test/plugins/metadata/debug.coffee index c160be4ac..eb241f5ad 100644 --- a/packages/core/test/plugins/metadata/debug.coffee +++ b/packages/core/test/plugins/metadata/debug.coffee @@ -47,7 +47,7 @@ describe 'metadata "debug"', -> ws.write = (chunk) -> data.push chunk await nikita.call $debug: ws, ({tools: {log}}) -> log 'Some message' - data.join().should.eql '\u001b[32m[1.1.INFO call] Some message\u001b[39m\n' + data.join().should.eql '\u001b[32m[text 1.1 INFO call] Some message\u001b[39m\n' it 'stdin, stdout, stderr', -> data = [] @@ -59,10 +59,10 @@ describe 'metadata "debug"', -> """ $debug: ws data.join().should.eql [ - '\u001b[33m[1.1.INFO execute] echo to_stdout; echo to_stderr 1>&2\u001b[39m\n' - '\u001b[36m[1.1.INFO execute] to_stdout\u001b[39m\n' - '\u001b[35m[1.1.INFO execute] to_stderr\u001b[39m\n' - '\u001b[32m[1.1.DEBUG execute] Command exit with status: 0\u001b[39m\n' + '\u001b[33m[stdin 1.1 INFO execute] echo to_stdout; echo to_stderr 1>&2\u001b[39m\n' + '\u001b[36m[stdout 1.1 INFO execute] to_stdout\u001b[39m\n' + '\u001b[35m[stderr 1.1 INFO execute] to_stderr\u001b[39m\n' + '\u001b[32m[text 1.1 DEBUG execute] Command exit with status: 0\u001b[39m\n' ].join() describe 'print', -> @@ -75,7 +75,7 @@ describe 'metadata "debug"', -> $debug: true $handler: ({tools: {log}}) -> log 'Some message' process.stderr.write = write - data.join().should.eql '\u001b[32m[1.1.INFO call] Some message\u001b[39m\n' + data.join().should.eql '\u001b[32m[text 1.1 INFO call] Some message\u001b[39m\n' it 'stdout', -> data = [] @@ -85,7 +85,7 @@ describe 'metadata "debug"', -> $debug: 'stdout' $handler: ({tools: {log}}) -> log 'Some message' process.stdout.write = write - data.join().should.eql '\u001b[32m[1.1.INFO call] Some message\u001b[39m\n' + data.join().should.eql '\u001b[32m[text 1.1 INFO call] Some message\u001b[39m\n' it 'stream writer', -> data = [] @@ -94,7 +94,7 @@ describe 'metadata "debug"', -> await nikita.call $debug: ws $handler: ({tools: {log}}) -> log 'Some message' - data.join().should.eql '\u001b[32m[1.1.INFO call] Some message\u001b[39m\n' + data.join().should.eql '\u001b[32m[text 1.1 INFO call] Some message\u001b[39m\n' describe 'cascade', -> @@ -108,8 +108,8 @@ describe 'metadata "debug"', -> await @call ({tools: {log}}) -> log 'Child message' data.join().should.eql [ - '\u001b[32m[1.1.INFO call] Parent message\u001b[39m\n' - '\u001b[32m[1.1.2.INFO call] Child message\u001b[39m\n' + '\u001b[32m[text 1.1 INFO call] Parent message\u001b[39m\n' + '\u001b[32m[text 1.1.2 INFO call] Child message\u001b[39m\n' ].join ',' it 'not available in parent', -> @@ -120,7 +120,7 @@ describe 'metadata "debug"', -> log 'Parent message' @call $debug: ws, ({tools: {log}}) -> log 'Child message' - data.join().should.eql '\u001b[32m[1.1.1.INFO call] Child message\u001b[39m\n' + data.join().should.eql '\u001b[32m[text 1.1.1 INFO call] Child message\u001b[39m\n' it 'not available in parent sibling', -> data = [] @@ -133,6 +133,6 @@ describe 'metadata "debug"', -> log 'Child message' .call ({tools: {log}}) -> log 'Sibling message' - data.join().should.eql '\u001b[32m[1.1.2.INFO call] Child message\u001b[39m\n' + data.join().should.eql '\u001b[32m[text 1.1.2 INFO call] Child message\u001b[39m\n'