File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import {
33
33
} from "../../logger.js" ;
34
34
import * as vm from "./vm/sdk_shared_core_wasm_bindings.js" ;
35
35
import { CompletablePromise } from "../../utils/completable_promise.js" ;
36
+ import { HandlerKind } from "../../types/rpc.js" ;
36
37
37
38
export interface Headers {
38
39
[ name : string ] : string | string [ ] | undefined ;
@@ -278,9 +279,9 @@ export class GenericHandler implements RestateHandler {
278
279
LogSource . USER ,
279
280
new LoggerContext (
280
281
input . invocation_id ,
281
- "" ,
282
282
handler . component ( ) . name ( ) ,
283
283
handler . name ( ) ,
284
+ handler . kind ( ) === HandlerKind . SERVICE ? undefined : input . key ,
284
285
additionalContext
285
286
) ,
286
287
( ) => ! coreVm . is_processing ( )
Original file line number Diff line number Diff line change @@ -115,26 +115,27 @@ function readRestateLogLevel(): RestateLogLevel {
115
115
}
116
116
117
117
export class LoggerContext {
118
- readonly fqMethodName : string ;
118
+ readonly invocationTarget : string ;
119
119
120
120
constructor (
121
121
readonly invocationId : string ,
122
- packageName : string ,
123
- serviceName : string ,
124
- handlerName : string ,
122
+ readonly serviceName : string ,
123
+ readonly handlerName : string ,
124
+ readonly key ? : string ,
125
125
readonly additionalContext ?: { [ name : string ] : string }
126
126
) {
127
- this . fqMethodName = packageName
128
- ? `${ packageName } .${ serviceName } /${ handlerName } `
129
- : `${ serviceName } /${ handlerName } ` ;
127
+ this . invocationTarget =
128
+ key === undefined || key . length === 0
129
+ ? `${ serviceName } /${ handlerName } `
130
+ : `${ serviceName } /${ key } /${ handlerName } ` ;
130
131
}
131
132
}
132
133
133
134
function formatLogPrefix ( context ?: LoggerContext ) : string {
134
135
if ( context === undefined ) {
135
136
return "[restate] " ;
136
137
}
137
- let prefix = `[restate] [${ context . fqMethodName } ][${ context . invocationId } ]` ;
138
+ let prefix = `[restate] [${ context . invocationTarget } ][${ context . invocationId } ]` ;
138
139
if ( context . additionalContext !== undefined ) {
139
140
for ( const [ k , v ] of Object . entries ( context . additionalContext ) ) {
140
141
prefix = prefix + `[${ k } : ${ v } ]` ;
You can’t perform that action at this time.
0 commit comments