Socket
Socket
Sign inDemoInstall

@antora/logger

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/logger - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

53

lib/logger.js

@@ -9,4 +9,5 @@ 'use strict'

levels: { labels: levelLabels, values: levelValues },
symbols: { serializersSym: $serializers, streamSym: $stream },
symbols: { streamSym: $stream },
pino,
stdSerializers: { err: defaultErrSerializer },
} = require('pino')

@@ -16,5 +17,7 @@ const { default: pinoPretty, prettyFactory } = require('pino-pretty')

const INF = Infinity
const WRAP = '\n '
const closedLogger = { closed: true }
const finalizers = []
const INF = Infinity
const minLevel = levelLabels[Math.min.apply(null, Object.keys(levelLabels))]

@@ -24,2 +27,6 @@ const noopLogger = pino({ base: null, enabled: false, timestamp: false }, {})

const standardStreams = { 1: 1, 2: 2, stderr: 2, stdout: 1 }
const errSerializer = (err) => {
if (!(err = defaultErrSerializer(err)).message) delete err.message
return err
}

@@ -67,3 +74,3 @@ function close () {

if (arg0 instanceof Error) {
reshapeErrorForLog(arg0, args[1], prettyPrint && this[$serializers].err).forEach((v, i) => (args[i] = v))
reshapeErrorForLog(arg0, args[1], prettyPrint && errSerializer).forEach((v, i) => (args[i] = v))
} else if (arg0.constructor === Object && typeof arg0.file === 'object') {

@@ -76,2 +83,3 @@ const { file, line, stack, ...obj } = arg0

},
serializers: { err: errSerializer },
}

@@ -128,27 +136,23 @@ close()

file: ({ path: path_, line }) => (line == null ? path_ : `${path_}:${line}`),
stack: (stack, _, log) => {
stack (stack, _, { source: prevSource = {} }) {
if (!Array.isArray(stack)) return JSON.stringify(stack, null, 2)
let prevSource = log.source
return stack
.map(({ file: { path: path_, line }, source }) => {
const file = `${path_}:${line}`
.map(({ file: { path: path_, line }, source = {} }) => {
const file = line == null ? path_ : `${path_}:${line}`
const sameSource =
prevSource &&
source.url === prevSource.url &&
source.reftype === prevSource.reftype &&
source.refname === prevSource.refname &&
source.worktree === prevSource.worktree &&
source.startPath === prevSource.startPath
prevSource = source
if (sameSource) return `\n file: ${file}`
const { url, worktree, refname, startPath } = source
source = worktree
? `${worktree} (refname: ${refname} <worktree>${startPath ? ', start path: ' + startPath : ''})`
: `${url || '<unknown>'} (refname: ${refname}${startPath ? ', start path: ' + startPath : ''})`
return `\n file: ${file}\n source: ${source}`
return sameSource ? `${WRAP}file: ${file}` : `${WRAP}file: ${file}${WRAP}source: ${this.source(source)}`
})
.join('')
},
source: ({ url, worktree, refname, startPath }) =>
worktree
? `${worktree} (refname: ${refname} <worktree>${startPath ? ', start path: ' + startPath : ''})`
: `${url || '<unknown>'} (refname: ${refname}${startPath ? ', start path: ' + startPath : ''})`,
source: ({ url, local, worktree, refname, reftype, remote, startPath }) => {
const pathInfo = startPath ? ` | start path: ${startPath}` : ''
const flag = worktree ? ' <worktree>' : remote ? ` <remotes/${remote}>` : ''
return `${worktree || local || url || '<unknown>'} (${reftype}: ${refname}${flag}${pathInfo})`
},
},

@@ -177,3 +181,3 @@ ignore: 'hint',

function reshapeErrorForLog (err, msg, prettyPrint, serialize) {
function reshapeErrorForLog (err, msg, prettyPrint) {
const { name, message } = err

@@ -187,3 +191,3 @@ let stack

} else if ((stack = err.stack || name) && err instanceof SyntaxError && stack.includes('\nSyntaxError: ')) {
stack = `SyntaxError: ${message}\n at ` + stack.split(/\n+SyntaxError: [^\n]+\n?/).join('\n')
stack = `SyntaxError: ${message}${WRAP}at ` + stack.split(/\n+SyntaxError: [^\n]+\n?/).join('\n')
}

@@ -203,8 +207,9 @@ if (message && (message === msg || !prettyPrint) && stack.startsWith(`${name}: ${message}`)) {

if (origin) {
const { url, refname, startPath, worktree } = origin
const { url, gitdir, worktree, tag, reftype = tag ? 'tag' : 'branch', refname, remote, startPath } = origin
const local = 'worktree' in origin && (gitdir || url)
const logObject = {
file: { path: abspath || path.join(startPath, vpath), line },
source: worktree
? { url, worktree, refname, startPath: startPath || undefined }
: { url, refname, startPath: startPath || undefined },
source: local
? { url, local, worktree, refname, reftype, remote, startPath: startPath || undefined }
: { url, refname, reftype, startPath: startPath || undefined },
}

@@ -211,0 +216,0 @@ if (stack) logObject.stack = stack.map(reshapeFileForLog)

{
"name": "@antora/logger",
"version": "3.0.3",
"version": "3.1.0",
"description": "The logger for Antora.",

@@ -17,10 +17,14 @@ "license": "MPL-2.0",

"main": "lib/index.js",
"exports": {
".": "./lib/index.js",
"./package.json": "./package.json"
},
"dependencies": {
"@antora/expand-path-helper": "~2.0",
"pino": "~7.6",
"pino-pretty": "~7.3",
"sonic-boom": "~2.4"
"pino": "~8.4",
"pino-pretty": "~9.0",
"sonic-boom": "~3.2"
},
"engines": {
"node": ">=12.21.0"
"node": ">=16.0.0"
},

@@ -27,0 +31,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc