# Template Logger (/v2.29.1/template-logger)

<!-- agent-signals: reading_time_min: 3 · est_tokens: 1113 · updated: 2026-07-30 -->
Related: [Errors](/v2.29.1/errors.md), [Sandbox](/v2.29.1/sandbox.md), [Sandbox Commands](/v2.29.1/sandbox-commands.md), [Sandbox Filesystem](/v2.29.1/sandbox-filesystem.md), [Template](/v2.29.1/template.md), [Template Readycmd](/v2.29.1/template-readycmd.md)

### LogEntry [#logentry]

Represents a single log entry from the template build process.

#### Extended by [#extended-by]

* `LogEntryStart`
* `LogEntryEnd`

#### Constructors [#constructors]

```ts
new LogEntry(
   timestamp: Date, 
   level: LogEntryLevel, 
   message: string): LogEntry
```

###### Parameters [#parameters]

| Parameter   | Type            |
| ----------- | --------------- |
| `timestamp` | `Date`          |
| `level`     | `LogEntryLevel` |
| `message`   | `string`        |

###### Returns [#returns]

`LogEntry`

#### Properties [#properties]

| Property                         | Modifier   | Type            |
| -------------------------------- | ---------- | --------------- |
| <a id="level" /> `level`         | `readonly` | `LogEntryLevel` |
| <a id="message" /> `message`     | `readonly` | `string`        |
| <a id="timestamp" /> `timestamp` | `readonly` | `Date`          |

#### Methods [#methods]

### toString() [#tostring]

```ts
toString(): string
```

###### Returns [#returns-1]

`string`

***

### LogEntryEnd [#logentryend]

Special log entry indicating the end of a build process.

#### Constructors [#constructors-1]

```ts
new LogEntryEnd(timestamp: Date, message: string): LogEntryEnd
```

###### Parameters [#parameters-1]

| Parameter   | Type     |
| ----------- | -------- |
| `timestamp` | `Date`   |
| `message`   | `string` |

###### Returns [#returns-2]

`LogEntryEnd`

#### Properties [#properties-1]

| Property                           | Modifier   | Type            | Inherited from         |
| ---------------------------------- | ---------- | --------------- | ---------------------- |
| <a id="level-1" /> `level`         | `readonly` | `LogEntryLevel` | `LogEntry`.`level`     |
| <a id="message-1" /> `message`     | `readonly` | `string`        | `LogEntry`.`message`   |
| <a id="timestamp-1" /> `timestamp` | `readonly` | `Date`          | `LogEntry`.`timestamp` |

#### Methods [#methods-1]

### toString() [#tostring-1]

```ts
toString(): string
```

###### Returns [#returns-3]

`string`

***

### LogEntryStart [#logentrystart]

Special log entry indicating the start of a build process.

#### Constructors [#constructors-2]

```ts
new LogEntryStart(timestamp: Date, message: string): LogEntryStart
```

###### Parameters [#parameters-2]

| Parameter   | Type     |
| ----------- | -------- |
| `timestamp` | `Date`   |
| `message`   | `string` |

###### Returns [#returns-4]

`LogEntryStart`

#### Properties [#properties-2]

| Property                           | Modifier   | Type            | Inherited from         |
| ---------------------------------- | ---------- | --------------- | ---------------------- |
| <a id="level-2" /> `level`         | `readonly` | `LogEntryLevel` | `LogEntry`.`level`     |
| <a id="message-2" /> `message`     | `readonly` | `string`        | `LogEntry`.`message`   |
| <a id="timestamp-2" /> `timestamp` | `readonly` | `Date`          | `LogEntry`.`timestamp` |

#### Methods [#methods-2]

### toString() [#tostring-2]

```ts
toString(): string
```

###### Returns [#returns-5]

`string`

## Type Aliases [#type-aliases]

### LogEntryLevel [#logentrylevel]

```ts
type LogEntryLevel = "debug" | "info" | "warn" | "error";
```

Log entry severity levels.

## Functions [#functions]

### defaultBuildLogger() [#defaultbuildlogger]

```ts
function defaultBuildLogger(options?: object): (logEntry: LogEntry) => void
```

Create a default build logger with animated timer display.

#### Parameters [#parameters-3]

| Parameter           | Type                              | Description                                    |
| ------------------- | --------------------------------- | ---------------------------------------------- |
| `options`?          | \{ `minLevel`: `LogEntryLevel`; } | Logger configuration options                   |
| `options.minLevel`? | `LogEntryLevel`                   | Minimum log level to display (default: 'info') |

#### Returns [#returns-6]

`Function`

Logger function that accepts LogEntry instances

### Parameters [#parameters-4]

| Parameter  | Type       |
| ---------- | ---------- |
| `logEntry` | `LogEntry` |

### Returns [#returns-7]

`void`

#### Example [#example]

```ts
import { Template, defaultBuildLogger } from 'e2b'

const template = Template().fromPythonImage()

await Template.build(template, {
  alias: 'my-template',
  onBuildLogs: defaultBuildLogger({ minLevel: 'debug' })
})
```
