I see too much stuff on my logs when working locally:
[offline] event: { headers:
{ Host: 'localhost:3000',
Connection: 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'fr,en;q=0.9,en-GB;q=0.8,en-US;q=0.7,de;q=0.6',
Cookie: '_ga=GA1.1.328134459.1544186943; _hjIncludedInSample=1; Webstorm-972a3ff6=17aba6b8-722b-43e7-abdc-2ddfa8f2a7eb; Pycharm-58642f01=d30ec4ca-f2fe-446b-9ff4-3b2593098d01; Webstorm-972a43b5=17aba6b8-722b-43e7-abdc-2ddfa8f2a7eb; _gid=GA1.1.128983471.1558859680' },
path: '/fetchMergedFormsResponses',
pathParameters: null,
requestContext:
{ accountId: 'offlineContext_accountId',
resourceId: 'offlineContext_resourceId',
apiId: 'offlineContext_apiId',
stage: 'development',
requestId: 'offlineContext_requestId_47121564470636335',
identity:
{ cognitoIdentityPoolId: 'offlineContext_cognitoIdentityPoolId',
accountId: 'offlineContext_accountId',
cognitoIdentityId: 'offlineContext_cognitoIdentityId',
caller: 'offlineContext_caller',
apiKey: 'offlineContext_apiKey',
sourceIp: '127.0.0.1',
cognitoAuthenticationType: 'offlineContext_cognitoAuthenticationType',
cognitoAuthenticationProvider: 'offlineContext_cognitoAuthenticationProvider',
userArn: 'offlineContext_userArn',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',
user: 'offlineContext_user' },
authorizer:
{ principalId: 'offlineContext_authorizer_principalId',
claims: undefined },
protocol: 'HTTP/1.1',
resourcePath: '/fetchMergedFormsResponses',
httpMethod: 'GET' },
resource: '/fetchMergedFormsResponses',
httpMethod: 'GET',
queryStringParameters:
{ form_ids: 'PamXTA,kLhRGM',
proxy_tokens: 'NDQ4omMlioJn1FxxZB0PgBXcajjq6ZkMBBhofj9ozpaXM8a4h5KAubF9yoxF5g2b29G6hRuyRPmyQ2pXt6pfECSeSLJPzEXbEDgP,5Ek6m0ydoK6seIQZVDOVkw2AB3MWZjyRCbvpKR29ee82DldLg0QuhzesPaKZlQlfTE23L0a1swYW1EE5I5DtT9lDBrif4cZakENJ',
debug: '',
outputData: 'csv',
countryRef: 'identity_nationality',
lang: 'fr' },
stageVariables: null,
body: null,
isOffline: true }
Is there a way to suppress those logs ([offline] event)? I already am using --dontPrintOutput option
Are you using Python as your lambdas language ?
I'm using node, why?
Can you tell me how to reproduce please?
Do you mean using --dontPrintOutput should silent those logs?
--dontPrintOutput is not an option 馃
It's an old one
I'm using "serverless-offline": "4.9.4",
Ah, I migrated to a newer version and didn't notice the option had gone.
It's been replaced by printOutput, so it silents part of the log by default now (which is a good thing)
But, is there any way to silent those as well? I tried to look for debugLog calls but couldn't find anything related to event
https://github.com/dherault/serverless-offline/search?q=debugLog%28&unscoped_q=debugLog%28
hey @Vadorequest , could you give a concrete example with using the latest version?
[offline] event: { headers: ... is the most noisy, since it repeats for every endpoints, when using a framework such as Next.js, it's printed 5-7 times, because many routes are loaded by the frontend, such as _app.js, _error.js, etc. It results in a very important noise and I'd like to just disable event logs in development mode (or display a much smaller version)
@Vadorequest we'll probably add some options to reduce the noise. just have to come up with some mechanism to allow certain ones, and filter others (e.g. info, debug, error ...). stay tuned.
Yep, it would be nice to only log error level messages when testing a bunch of lambdas
@dnalborczyk any update on this? @dherault
just have to come up with some mechanism to allow certain ones,
and filter others (e.g. info, debug, error ...). stay tuned.
npm i debug? It's a de facto instrumentation standard. pretty many modules are instrumented, and you can suppress or allow categories using env.
Most helpful comment
@Vadorequest we'll probably add some options to reduce the noise. just have to come up with some mechanism to allow certain ones, and filter others (e.g. info, debug, error ...). stay tuned.