File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1378,6 +1378,14 @@ class Logger extends Utility implements LoggerInterface {
1378
1378
this . #bufferConfig. bufferAtVerbosity =
1379
1379
LogLevelThreshold [ bufferAtLogLevel ] ;
1380
1380
}
1381
+ const AlcLogLevel =
1382
+ this . getEnvVarsService ( ) . getAwsLogLevel ( ) as keyof typeof LogLevelThreshold ;
1383
+
1384
+ if ( LogLevelThreshold [ AlcLogLevel ] > this . #bufferConfig. bufferAtVerbosity ) {
1385
+ this . #warnOnce(
1386
+ 'Advanced Loggging Controls (ALC) Log Level is higher than Log Buffering Log Level. Buffered logs will be filtered by ALC'
1387
+ ) ;
1388
+ }
1381
1389
}
1382
1390
1383
1391
/**
Original file line number Diff line number Diff line change @@ -92,6 +92,28 @@ describe('Buffer logs', () => {
92
92
) ;
93
93
} ) ;
94
94
95
+ it ( 'outputs a warning when the Advanced Logging Configuration Log Level is higher than the Log Buffering Log Level' , ( ) => {
96
+ // Assemble
97
+ process . env . AWS_LAMBDA_LOG_LEVEL = 'INFO' ;
98
+ const logger = new Logger ( {
99
+ logLevel : LogLevel . DEBUG ,
100
+ logBufferOptions : { enabled : true , bufferAtVerbosity : 'DEBUG' } ,
101
+ } ) ;
102
+
103
+ // Act
104
+ logger . debug ( 'This is a debug' ) ;
105
+
106
+ // Assess
107
+ expect ( console . warn ) . toHaveLogged (
108
+ expect . objectContaining ( {
109
+ message : expect . stringContaining (
110
+ 'Advanced Loggging Controls (ALC) Log Level is higher than Log Buffering Log Level. Buffered logs will be filtered by ALC'
111
+ ) ,
112
+ level : LogLevel . WARN ,
113
+ } )
114
+ ) ;
115
+ } ) ;
116
+
95
117
it ( 'outputs a warning when there is an error buffering the log' , ( ) => {
96
118
// Prepare
97
119
const logger = new Logger ( { logBufferOptions : { maxBytes : 100 } } ) ;
You can’t perform that action at this time.
0 commit comments