7
7
ConstructFactoryGetInstanceProps ,
8
8
FunctionResources ,
9
9
GenerateContainerEntryProps ,
10
+ LogLevel ,
11
+ LogRetention ,
10
12
ResourceProvider ,
11
13
} from '@aws-amplify/plugin-types' ;
12
14
import {
@@ -17,6 +19,10 @@ import {
17
19
import path from 'path' ;
18
20
import { CallerDirectoryExtractor } from '@aws-amplify/platform-core' ;
19
21
import { AiModel } from '@aws-amplify/data-schema-types' ;
22
+ import {
23
+ LogLevelConverter ,
24
+ LogRetentionConverter ,
25
+ } from '@aws-amplify/platform-core/cdk' ;
20
26
21
27
class ConversationHandlerFunctionGenerator
22
28
implements ConstructContainerEntryGenerator
@@ -47,6 +53,18 @@ class ConversationHandlerFunctionGenerator
47
53
outputStorageStrategy : this . outputStorageStrategy ,
48
54
memoryMB : this . props . memoryMB ,
49
55
} ;
56
+ const logging : typeof constructProps . logging = { } ;
57
+ if ( this . props . logging ?. level ) {
58
+ logging . level = new LogLevelConverter ( ) . toCDKLambdaApplicationLogLevel (
59
+ this . props . logging . level
60
+ ) ;
61
+ }
62
+ if ( this . props . logging ?. retention ) {
63
+ logging . retention = new LogRetentionConverter ( ) . toCDKRetentionDays (
64
+ this . props . logging . retention
65
+ ) ;
66
+ }
67
+ constructProps . logging = logging ;
50
68
const conversationHandlerFunction = new ConversationHandlerFunction (
51
69
scope ,
52
70
this . props . name ,
@@ -115,6 +133,15 @@ class DefaultConversationHandlerFunctionFactory
115
133
} ;
116
134
}
117
135
136
+ export type ConversationHandlerFunctionLogLevel = LogLevel ;
137
+
138
+ export type ConversationHandlerFunctionLogRetention = LogRetention ;
139
+
140
+ export type ConversationHandlerFunctionLoggingOptions = {
141
+ retention ?: ConversationHandlerFunctionLogRetention ;
142
+ level ?: ConversationHandlerFunctionLogLevel ;
143
+ } ;
144
+
118
145
export type DefineConversationHandlerFunctionProps = {
119
146
name : string ;
120
147
entry ?: string ;
@@ -128,6 +155,7 @@ export type DefineConversationHandlerFunctionProps = {
128
155
* Default is 512MB.
129
156
*/
130
157
memoryMB ?: number ;
158
+ logging ?: ConversationHandlerFunctionLoggingOptions ;
131
159
} ;
132
160
133
161
/**
0 commit comments