Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/pino/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict'
var test = require('tap').test
var pino = require('../')
var pretty = require('../pretty')
var writer = require('flush-write-stream')
function capture () {
var ws = writer(function (chunk, enc, cb) {
this.data += chunk.toString()
cb()
})
ws.data = ''
return ws
}
test('pino uses LF by default', function (t) {
t.plan(1)
var stream = capture()
var logger = pino(stream)
logger.info('foo')
logger.error('bar')
t.ok(/foo[^\r\n]+\n[^\r\n]+bar[^\r\n]+\n/.test(stream.data))
t.end()
})
test('pino can log CRLF', function (t) {
t.plan(1)
var stream = capture()
var logger = pino({
crlf: true
}, stream)
logger.info('foo')
logger.error('bar')
t.ok(/foo[^\n]+\r\n[^\n]+bar[^\n]+\r\n/.test(stream.data))
t.end()
})
test('pretty can log CRLF', function (t) {
t.plan(1)
var prettier = pretty({
crlf: true,
formatter: function (data) {
return data.msg
}
})
var stream = capture()
prettier.pipe(stream)
var logger = pino(prettier)
logger.info('foo')
logger.info('bar')
t.is(stream.data, 'foo\r\nbar\r\n')
t.end()
})
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.054 ]-- |