File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed
packages/event-handler/src Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 2
2
EnvironmentVariablesService ,
3
3
isRecord ,
4
4
} from '@aws-lambda-powertools/commons' ;
5
+ import type { GenericLogger } from '@aws-lambda-powertools/commons/types' ;
6
+ import { getStringFromEnv } from '@aws-lambda-powertools/commons/utils/env' ;
5
7
import type {
6
- GenericLogger ,
7
8
GraphQlRouteOptions ,
8
9
GraphQlRouterOptions ,
9
10
OnMutationHandler ,
@@ -40,7 +41,10 @@ class Router {
40
41
41
42
public constructor ( options ?: GraphQlRouterOptions ) {
42
43
this . envService = new EnvironmentVariablesService ( ) ;
43
- const alcLogLevel = this . envService . get ( 'AWS_LAMBDA_LOG_LEVEL' ) ;
44
+ const alcLogLevel = getStringFromEnv ( {
45
+ key : 'AWS_LAMBDA_LOG_LEVEL' ,
46
+ defaultValue : '' ,
47
+ } ) ;
44
48
this . logger = options ?. logger ?? {
45
49
debug : alcLogLevel === 'DEBUG' ? console . debug : ( ) => undefined ,
46
50
error : console . error ,
Original file line number Diff line number Diff line change 1
1
import type { RouteHandlerRegistry } from '../appsync-graphql/RouteHandlerRegistry.js' ;
2
-
3
- // biome-ignore lint/suspicious/noExplicitAny: We intentionally use `any` here to represent any type of data and keep the logger is as flexible as possible.
4
- type Anything = any ;
5
-
6
- /**
7
- * Interface for a generic logger object.
8
- */
9
- type GenericLogger = {
10
- trace ?: ( ...content : Anything [ ] ) => void ;
11
- debug : ( ...content : Anything [ ] ) => void ;
12
- info ?: ( ...content : Anything [ ] ) => void ;
13
- warn : ( ...content : Anything [ ] ) => void ;
14
- error : ( ...content : Anything [ ] ) => void ;
15
- } ;
2
+ import type { Anything , GenericLogger } from './common.js' ;
16
3
17
4
// #region OnQuery fn
18
5
You can’t perform that action at this time.
0 commit comments