UNPKG

@athenna/logger

Version:

The Athenna logging solution. Log in stdout, files and buckets.

31 lines (30 loc) 920 B
/** * @athenna/logger * * (c) João Lenon <lenon@athenna.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { debug } from '#src/debug'; import { Driver } from '#src/drivers/Driver'; import { logger } from '#src/helpers/AwsLogger'; export class LambdaDriver extends Driver { transport(level, message) { if (!this.couldBeTransported(level)) { return; } const levelMap = { info: 'info', warn: 'warn', trace: 'debug', debug: 'debug', error: 'error', success: 'info', fatal: 'critical' }; const formatted = this.format(levelMap[level], message); debug('[%s] Transporting logs using AWS Powertools.', LambdaDriver.name); return logger[levelMap[level]](formatted); } }