---
title: Avoid leaving console debug statements
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Avoid leaving console debug statements
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Avoid leaving console debug statements

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `typescript-best-practices/no-console`

**Language:** TypeScript

**Severity:** Warning

**Category:** Best Practices

## Description{% #description %}

Debugging with `console` is not considered a bad practice, but it's easy to forget about `console` statements and leave them in production code. There is no need to pollute production builds with debugging statements.

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```typescript
console.log(foo)
console.error(foo)
console.info(foo)
console.warn(foo)
```

## Compliant Code Examples{% #compliant-code-examples %}

```typescript
Console.info(foo)
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 