• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Cette traduction automatique est fournie pour votre commodité.

En cas d'incohérence entre la version anglaise et la version traduite, la version anglaise prévaudra. Veuillez visiter cette page pour plus d'informations.

Créer un problème

logger

Un ensemble de méthodes pour remplacer console.log(), console.warn() et console.error().

Usage

import { logger } from 'nr1'

Méthodes

logger.error

function (
message: string,

JavaScript string containing zero or more substitution strings. To print the percentage sign, use double encoding (%%).

...params: Object[]

JavaScript objects with which to replace substitution strings within message. This gives you additional control over the format of the output.

) => undefined
const state = { foo: 42, bar: 'token' };
logger.error('Invalid state passed: %O', state);

logger.log

function (
message: string,

JavaScript string containing zero or more substitution strings. To print the percentage sign, use double encoding (%%).

...params: Object[]

JavaScript objects with which to replace substitution strings within message. This gives you additional control over the format of the output.

) => undefined
logger.log('Hello, my name is %s', 'John Doe');

logger.warn

function (
message: string,

JavaScript string containing zero or more substitution strings. To print the percentage sign, use double encoding (%%).

...params: Object[]

JavaScript objects with which to replace substitution strings within message. This gives you additional control over the format of the output.

) => undefined
logger.warn('Threshold exceeded by %d%%!', 35);
Droits d'auteur © 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.