# logged() function · @imqueue/rpc

Source: https://imqueue.org/api/rpc/latest/rpc.logged/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/rpc 3.5.3 — generated reference, not hand-written

Creates a `@logged()` method decorator that wraps the decorated method in a try/catch and logs any error it throws. The logger is resolved in this order: an explicitly passed logger, then a `logger` defined on the instance or on the class, and finally the global `console`. By default the error is re-thrown after being logged; pass `{ doNotThrow: true }` to swallow it. The returned decorator is dual-mode: it works both as a standard (TC39) and as a legacy method decorator.

**Signature:**

```typescript
export declare function logged(options?: ILogger | LoggedDecoratorOptions): any;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | ILogger \| [LoggedDecoratorOptions](https://imqueue.org/api/rpc/latest/rpc.loggeddecoratoroptions/) | _(Optional)_ a logger to use, or the logged-decorator options |


**Returns:**

any

a dual-mode method decorator

