• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

logger

A set of methods to replace console.log(), console.warn(), and console.error().

Usage

import { logger } from 'nr1'

Methods

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);
Copyright © 2024 New Relic Inc.

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