File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
packages/cli-v3/src/entryPoints/managed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 8
8
} from "@trigger.dev/core/v3/workers" ;
9
9
import { io , type Socket } from "socket.io-client" ;
10
10
import { RunnerEnv } from "./env.js" ;
11
- import { RunLogger , SendDebugLogOptions } from "./logger.js" ;
11
+ import { ManagedRunLogger , RunLogger , SendDebugLogOptions } from "./logger.js" ;
12
12
import { EnvObject } from "std-env" ;
13
13
import { RunExecution } from "./execution.js" ;
14
14
import { tryCatch } from "@trigger.dev/core/utils" ;
@@ -47,7 +47,7 @@ export class ManagedRunController {
47
47
projectRef : env . TRIGGER_PROJECT_REF ,
48
48
} ) ;
49
49
50
- this . logger = new RunLogger ( {
50
+ this . logger = new ManagedRunLogger ( {
51
51
httpClient : this . httpClient ,
52
52
env,
53
53
} ) ;
Original file line number Diff line number Diff line change @@ -14,16 +14,20 @@ export type SendDebugLogOptions = {
14
14
print ?: boolean ;
15
15
} ;
16
16
17
+ export interface RunLogger {
18
+ sendDebugLog ( options : SendDebugLogOptions ) : void ;
19
+ }
20
+
17
21
export type RunLoggerOptions = {
18
22
httpClient : WorkloadHttpClient ;
19
23
env : RunnerEnv ;
20
24
} ;
21
25
22
- export class RunLogger {
26
+ export class ManagedRunLogger implements RunLogger {
23
27
private readonly httpClient : WorkloadHttpClient ;
24
28
private readonly env : RunnerEnv ;
25
29
26
- constructor ( private readonly opts : RunLoggerOptions ) {
30
+ constructor ( opts : RunLoggerOptions ) {
27
31
this . httpClient = opts . httpClient ;
28
32
this . env = opts . env ;
29
33
}
@@ -59,3 +63,17 @@ export class RunLogger {
59
63
} ) ;
60
64
}
61
65
}
66
+
67
+ export class ConsoleRunLogger implements RunLogger {
68
+ private readonly print : boolean ;
69
+
70
+ constructor ( opts : { print ?: boolean } = { } ) {
71
+ this . print = opts . print ?? true ;
72
+ }
73
+
74
+ sendDebugLog ( { message, properties } : SendDebugLogOptions ) : void {
75
+ if ( this . print ) {
76
+ console . log ( "[ConsoleLogger]" , message , properties ) ;
77
+ }
78
+ }
79
+ }
Original file line number Diff line number Diff line change @@ -75,6 +75,12 @@ export class SnapshotManager {
75
75
return this . enqueueSnapshotChange ( { type : "suspendable" , value : suspendable } ) ;
76
76
}
77
77
78
+ /**
79
+ * Update the snapshot ID and status without invoking any handlers
80
+ *
81
+ * @param snapshotId - The ID of the snapshot to update to
82
+ * @param status - The status to update to
83
+ */
78
84
public updateSnapshot ( snapshotId : string , status : TaskRunExecutionStatus ) {
79
85
// Check if this is an old snapshot
80
86
if ( snapshotId < this . state . id ) {
You can’t perform that action at this time.
0 commit comments