Skip to content

Commit c2eed3a

Browse files
authored
chore: Export LoggerSinks from @temporalio/workflow (#889)
1 parent a225163 commit c2eed3a

File tree

6 files changed

+25
-26
lines changed

6 files changed

+25
-26
lines changed

packages/common/src/failure.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { temporal } from '@temporalio/proto';
2-
import { PayloadConverter } from './converter/payload-converter';
32
import { checkExtends, isRecord } from './type-helpers';
43

54
export const FAILURE_SOURCE = 'TypeScriptSDK';

packages/worker/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export {
1818
TelemetryOptions,
1919
TraceExporter,
2020
} from '@temporalio/core-bridge';
21+
export { LoggerSinks } from '@temporalio/workflow';
2122
export { ActivityInboundLogInterceptor, activityLogAttributes } from './activity-log-interceptor';
2223
export { NativeConnection as NativeConnection } from './connection';
2324
export { NativeConnectionOptions, RequiredNativeConnectionOptions, TLSConfig } from './connection-options';
@@ -39,5 +40,5 @@ export {
3940
WorkflowBundlePath,
4041
WorkflowBundlePathWithSourceMap, // eslint-disable-line deprecation/deprecation
4142
} from './worker-options';
42-
export { LoggerSinks, WorkflowInboundLogInterceptor, workflowLogAttributes } from './workflow-log-interceptor';
43+
export { WorkflowInboundLogInterceptor, workflowLogAttributes } from './workflow-log-interceptor';
4344
export { BundleOptions, bundleWorkflowCode, WorkflowBundleWithSourceMap } from './workflow/bundler';

packages/worker/src/worker-options.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { DataConverter, LoadedDataConverter } from '@temporalio/common';
1+
import { DataConverter, LoadedDataConverter, msToNumber } from '@temporalio/common';
22
import { loadDataConverter } from '@temporalio/common/lib/internal-non-workflow';
3-
import { msToNumber } from '@temporalio/common';
3+
import { LoggerSinks } from '@temporalio/workflow';
4+
import * as os from 'os';
5+
import * as v8 from 'v8';
46
import type { Configuration as WebpackConfiguration } from 'webpack';
57
import { ActivityInboundLogInterceptor } from './activity-log-interceptor';
68
import { NativeConnection } from './connection';
79
import { WorkerInterceptors } from './interceptors';
810
import { Runtime } from './runtime';
911
import { InjectedSinks } from './sinks';
1012
import { GiB } from './utils';
11-
import { LoggerSinks } from './workflow-log-interceptor';
1213
import { WorkflowBundleWithSourceMap } from './workflow/bundler';
13-
import * as v8 from 'v8';
14-
import * as os from 'os';
1514

1615
export type { WebpackConfiguration };
1716

packages/worker/src/workflow-log-interceptor.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
import {
2-
WorkflowInboundCallsInterceptor,
3-
WorkflowExecuteInput,
2+
isCancellation,
3+
LoggerSinks,
44
Next,
5+
proxySinks,
6+
WorkflowExecuteInput,
7+
WorkflowInboundCallsInterceptor,
58
workflowInfo,
69
WorkflowInfo,
7-
isCancellation,
8-
proxySinks,
9-
Sinks,
1010
WorkflowInterceptorsFactory,
1111
} from '@temporalio/workflow';
1212
import { untrackPromise } from '@temporalio/workflow/lib/stack-helpers';
1313

14-
/**
15-
* Sink interface for forwarding logs from the Workflow sandbox to the Worker
16-
*/
17-
export interface LoggerSinks extends Sinks {
18-
defaultWorkerLogger: {
19-
trace(message: string, attrs: Record<string, unknown>): void;
20-
debug(message: string, attrs: Record<string, unknown>): void;
21-
info(message: string, attrs: Record<string, unknown>): void;
22-
warn(message: string, attrs: Record<string, unknown>): void;
23-
error(message: string, attrs: Record<string, unknown>): void;
24-
};
25-
}
26-
2714
/**
2815
* Returns a map of attributes to be set on log messages for a given Workflow
2916
*/

packages/workflow/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export {
8686
EnhancedStackTrace,
8787
SDKInfo,
8888
} from './interfaces';
89-
export { Sink, SinkCall, SinkFunction, Sinks } from './sinks';
89+
export { LoggerSinks, Sink, SinkCall, SinkFunction, Sinks } from './sinks';
9090
export { Trigger } from './trigger';
9191
export * from './workflow';
9292
export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';

packages/workflow/src/sinks.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,16 @@ export interface SinkCall {
3939
fnName: string;
4040
args: any[];
4141
}
42+
43+
/**
44+
* Sink interface for forwarding logs from the Workflow sandbox to the Worker
45+
*/
46+
export interface LoggerSinks extends Sinks {
47+
defaultWorkerLogger: {
48+
trace(message: string, attrs: Record<string, unknown>): void;
49+
debug(message: string, attrs: Record<string, unknown>): void;
50+
info(message: string, attrs: Record<string, unknown>): void;
51+
warn(message: string, attrs: Record<string, unknown>): void;
52+
error(message: string, attrs: Record<string, unknown>): void;
53+
};
54+
}

0 commit comments

Comments
 (0)