Skip to content

browser: logger does not pass arguments to write function #2244

@Morriz

Description

@Morriz

when logging this way:

const log = logger('context')

log.debug('bla', { di: 'da' })

the arguments do not end up anywhere in the write function:

...
     browser: {
      write: (logObj, ...logParams) => {
        const { level, msg, time } = logObj as Record<string, string>
        const timeFormatted = new Date(time).toISOString()
        const levelColor = levelColors[level as keyof typeof levelColors]
        console.log(`[${timeFormatted}] ${levelColor}${level} ${color.cyan} ${msg} ${color.white}`, ...logParams)
      },
      formatters: {
        level: label => {
          return {
            level: label,
          }
        },
      },
    },
...

arguments always has length 1. Neither logObj contains them, and logParams is always undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions