> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# log

***

# Function: log()

## Call Signature

```ts theme={null}
function log<T, R>(
  options: LogOptions,
  fn: (...args: T) => R,
): (...args: T) => R;
```

Defined in: [src/wrappers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/wrappers.ts)

Wraps a function to log its execution as a span in Galileo.
Supports synchronous functions, Promises, and sync/async Generators.

### Type Parameters

#### T

`T` *extends* `unknown`\[]

#### R

`R`

### Parameters

#### options

`LogOptions`

The span options.

#### fn

(...`args`: `T`) => `R`

The function to wrap. Can return R, Promise\<R>, Generator\<R>, or AsyncGenerator\<R>.

### Returns

A wrapped function with the same signature and return type as fn.

```ts theme={null}
(...args: T): R;
```

#### Parameters

##### args

...`T`

#### Returns

`R`

## Call Signature

```ts theme={null}
function log<T, R>(
  options: LogOptions,
  fn: (...args: T) => Promise<R>,
): (...args: T) => Promise<R>;
```

Defined in: [src/wrappers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/wrappers.ts)

Wraps a function to log its execution as a span in Galileo.
Supports synchronous functions, Promises, and sync/async Generators.

### Type Parameters

#### T

`T` *extends* `unknown`\[]

#### R

`R`

### Parameters

#### options

`LogOptions`

The span options.

#### fn

(...`args`: `T`) => `Promise`\<`R`>

The function to wrap. Can return R, Promise\<R>, Generator\<R>, or AsyncGenerator\<R>.

### Returns

A wrapped function with the same signature and return type as fn.

```ts theme={null}
(...args: T): Promise<R>;
```

#### Parameters

##### args

...`T`

#### Returns

`Promise`\<`R`>

## Call Signature

```ts theme={null}
function log<T, R>(
  options: LogOptions,
  fn: (...args: T) => Generator<R>,
): (...args: T) => Generator<R>;
```

Defined in: [src/wrappers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/wrappers.ts)

Wraps a function to log its execution as a span in Galileo.
Supports synchronous functions, Promises, and sync/async Generators.

### Type Parameters

#### T

`T` *extends* `unknown`\[]

#### R

`R`

### Parameters

#### options

`LogOptions`

The span options.

#### fn

(...`args`: `T`) => `Generator`\<`R`>

The function to wrap. Can return R, Promise\<R>, Generator\<R>, or AsyncGenerator\<R>.

### Returns

A wrapped function with the same signature and return type as fn.

```ts theme={null}
(...args: T): Generator<R>;
```

#### Parameters

##### args

...`T`

#### Returns

`Generator`\<`R`>

## Call Signature

```ts theme={null}
function log<T, R>(
  options: LogOptions,
  fn: (...args: T) => AsyncGenerator<R>,
): (...args: T) => AsyncGenerator<R>;
```

Defined in: [src/wrappers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/wrappers.ts)

Wraps a function to log its execution as a span in Galileo.
Supports synchronous functions, Promises, and sync/async Generators.

### Type Parameters

#### T

`T` *extends* `unknown`\[]

#### R

`R`

### Parameters

#### options

`LogOptions`

The span options.

#### fn

(...`args`: `T`) => `AsyncGenerator`\<`R`>

The function to wrap. Can return R, Promise\<R>, Generator\<R>, or AsyncGenerator\<R>.

### Returns

A wrapped function with the same signature and return type as fn.

```ts theme={null}
(...args: T): AsyncGenerator<R>;
```

#### Parameters

##### args

...`T`

#### Returns

`AsyncGenerator`\<`R`>
