Skip to content
On this page

Empower Your Test Results with AI-Powered Insights ->

setLogger

Updates the builtin logger.

Syntax

js
setLogger(logger)

Usage

โœ… Correct Usage

js
setLogger({
  trace(messages) {   /* custom code */   },
  debug(messages) {   /* custom code */   },
  info(messages) {    /* custom code */   },
  warn(messages) {    /* custom code */   },
  error(messages) {   /* custom code */   }
})

Arguments

> logger (object)

logger object

Examples

js
const { settings } = require('pactum');

const myCustomLogger = {
  trace(messages) {   /* custom code */   },
  debug(messages) {   /* custom code */   },
  info(messages) {    /* custom code */   },
  warn(messages) {    /* custom code */   },
  error(messages) {   /* custom code */   }
};

settings.setLogger(myCustomLogger);

Released under the MIT License.