Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions docs/develop/typescript/platform/observability.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,15 @@ However, they differ from Activities in important ways:
Explicitly declaring a sink's interface is optional but is useful for ensuring type safety in subsequent steps:

<!--SNIPSTART typescript-logger-sink-interface-->
[sinks/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/sinks/src/workflows.ts)
[packages/test/src/workflows/log-sink-tester.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/log-sink-tester.ts)
```ts
import { log, proxySinks, Sinks } from '@temporalio/workflow';
import type { Sinks } from '@temporalio/workflow';

export interface AlertSinks extends Sinks {
alerter: {
alert(message: string): void;
export interface CustomLoggerSinks extends Sinks {
customLogger: {
info(message: string): void;
};
}

export type MySinks = AlertSinks;
```
<!--SNIPEND-->

Expand Down Expand Up @@ -353,14 +351,12 @@ main().catch((err) => {
#### Proxy and call a sink function from a Workflow

<!--SNIPSTART typescript-logger-sink-workflow-->
[sinks/src/workflows.ts](https://github.com/temporalio/samples-typescript/blob/main/sinks/src/workflows.ts)
[packages/test/src/workflows/log-sample.ts](https://github.com/temporalio/sdk-typescript/blob/main/packages/test/src/workflows/log-sample.ts)
```ts
const { alerter } = proxySinks<MySinks>();
import * as wf from '@temporalio/workflow';

export async function sinkWorkflow(): Promise<string> {
log.info('Workflow Execution started');
alerter.alert('alerter: Workflow Execution started');
return 'Hello, Temporal!';
export async function logSampleWorkflow(): Promise<void> {
wf.log.info('Workflow execution started');
}
```
<!--SNIPEND-->
Expand Down