Open edenmydev opened 2 years ago
Hi I am facing the same issue
`const logger = winston.createLogger({ transports: [ new CloudWatchTransport({ logGroupName: 'test-group', // REQUIRED logStreamName: ### 'tester-1', // REQUIRED createLogGroup: false, createLogStream: true, submissionInterval: 2000, submissionRetryCount: 1, batchSize: 20, awsConfig: { accessKeyId: CLOUDWATCH_ACCESS_KEY_ID, secretAccessKey: CLOUDWATCH_SECRET_ACCESS_KEY, region: CLOUDWATCH_REGION }}) ] })
logger.info(${variable_name}
);
`
@edenmydev try this way. It worked for me.
It looks like the fix for this is to set jsonMessage
to true
or provide a custom messageFormatter
in the options. Otherwise, the transport will default to only sending the "message" and "timestamp" properties via the default messageFormatter as text: https://github.com/lazywithclass/winston-cloudwatch/blob/09f8d4d3bfcef59703608e3cddfba0d6b039fd01/index.js#L26-L29
I can't see the metada sent with wintson in Cloudwatch. This is my file config:
For example: logger.error("getCardStatus - This card is not shared", {cardId:1});
will only print on Cloudwatch: info - getCardStatus - This card is not shared.