# ConsoleExporter
[EN] Source: https://mastra.ai/reference/observability/ai-tracing/exporters/console-exporter

Outputs trace events to the console for debugging and development.

## Constructor

```typescript
new ConsoleExporter(logger?: IMastraLogger)
```

<PropertiesTable
  props={[
    {
      name: "logger",
      type: "IMastraLogger",
      description:
        "Logger instance to use. Falls back to ConsoleLogger with INFO level if not provided",
      required: false,
    },
  ]}
/>

## Properties

```typescript
readonly name = 'tracing-console-exporter';
```

## Methods

### exportEvent

```typescript
async exportEvent(event: AITracingEvent): Promise<void>
```

Exports a tracing event to the console.

<PropertiesTable
  props={[
    {
      name: "event",
      type: "AITracingEvent",
      description: "The tracing event to export",
      required: true,
    },
  ]}
/>

### shutdown

```typescript
async shutdown(): Promise<void>
```

Logs shutdown message.

## Output Format

The exporter outputs different formats based on event type:

### SPAN_STARTED

```
🚀 SPAN_STARTED
   Type: [span type]
   Name: [span name]
   ID: [span id]
   Trace ID: [trace id]
   Input: [formatted input]
   Attributes: [formatted attributes]
────────────────────────────────────────
```

### SPAN_ENDED

```
✅ SPAN_ENDED
   Type: [span type]
   Name: [span name]
   ID: [span id]
   Duration: [duration]ms
   Trace ID: [trace id]
   Input: [formatted input]
   Output: [formatted output]
   Error: [formatted error if present]
   Attributes: [formatted attributes]
────────────────────────────────────────
```

### SPAN_UPDATED

```
📝 SPAN_UPDATED
   Type: [span type]
   Name: [span name]
   ID: [span id]
   Trace ID: [trace id]
   Input: [formatted input]
   Output: [formatted output]
   Error: [formatted error if present]
   Updated Attributes: [formatted attributes]
────────────────────────────────────────
```

## Usage

```typescript
import { ConsoleExporter } from "@mastra/core/ai-tracing";
import { ConsoleLogger, LogLevel } from "@mastra/core/logger";

// Use default logger (INFO level)
const exporter = new ConsoleExporter();

// Use custom logger
const customLogger = new ConsoleLogger({ level: LogLevel.DEBUG });
const exporterWithLogger = new ConsoleExporter(customLogger);
```

## Implementation Details

- Formats attributes as JSON with 2-space indentation
- Calculates and displays span duration in milliseconds
- Handles serialization errors gracefully
- Logs unimplemented event types as warnings
- Uses 80-character separator lines between events

## See Also

### Documentation

- [AI Tracing Overview](/docs/observability/ai-tracing/overview) - Complete guide
- [Exporters](/docs/observability/ai-tracing/overview#exporters) - Exporter concepts

### Other Exporters

- [DefaultExporter](/reference/observability/ai-tracing/exporters/default-exporter) - Storage persistence
- [CloudExporter](/reference/observability/ai-tracing/exporters/cloud-exporter) - Mastra Cloud
- [Langfuse](/reference/observability/ai-tracing/exporters/langfuse) - Langfuse integration
- [Braintrust](/reference/observability/ai-tracing/exporters/braintrust) - Braintrust integration

### Reference

- [Configuration](/reference/observability/ai-tracing/configuration) - Configuration options
- [Interfaces](/reference/observability/ai-tracing/interfaces) - Type definitions


---
title: "Reference: DefaultExporter | Observability"
description: API reference for the DefaultExporter
---

import PropertiesTable from "@site/src/components/PropertiesTable";