---
id: api/cypress-api/cypress-log
title: Cypress.log | Cypress Documentation
description: >-
  The internal API for controlling what gets printed to the Command Log of
  Cypress.
section: api
source_path: docs/api/cypress-api/cypress-log.mdx
version: e6988a974973e9090ce70406c38cb2b9e0eac9fa
updated_at: '2026-05-15T15:50:22.536Z'
---
# Cypress.log

This is the internal API for controlling what gets printed to the Command Log.

Useful when writing your own [custom commands](/llm/markdown/api/cypress-api/custom-commands.md).

## Syntax

```
Cypress.log(options)
```

### Arguments

**options _(Object)_**

Pass in an options object to `Cypress.log()`.

| Option | Default | Description |
| --- | --- | --- |
| `$el` | `undefined` |  |
| `name` | `name of the command` |  |
| `displayName` | `name of the command` | Overrides `name` only for display purposes. |
| `message` | `command args` |  |
| `consoleProps` | `function() {}` |  |

## Examples

We want the Command Log and the console in the DevTools to log specific properties of our custom command.

```
Cypress.Commands.add('setSessionStorage', (key, value) => {  // Turn off logging of the cy.window() to command log  cy.window({ log: false }).then((window) => {    window.sessionStorage.setItem(key, value)  })  const log = Cypress.log({    name: 'setSessionStorage',    // shorter name for the Command Log    displayName: 'setSS',    message: `${key}, ${value}`,    consoleProps: () => {      // return an object which will      // print to dev tools console on click      return {        Key: key,        Value: value,        'Session Storage': window.sessionStorage,      }    },  })})
```

The code above displays in the Command Log as shown below, with the console properties shown on click of the command.

## See also

*   [`Commands`](/llm/markdown/api/cypress-api/custom-commands.md)
