/**
 * Simple logger that just writes to the console.
 */ import { ILogger } from 'polar-shared/src/logger/ILogger' ; import { PackageManifest } from '../../util/PackageManifest' ; /**
 * Annotates logs by including the version
 */ export class VersionAnnotatingLogger implements ILogger { public readonly name : string ; private readonly delegate : ILogger ; private readonly versionAnnotation : string ; constructor ( delegate ) { this . delegate = delegate ; this . name = `version-annotating-logger -> ${ delegate . name }` ; const packageManifest = new PackageManifest ( ) ; this . versionAnnotation = `[${ packageManifest . version ( ) }]` ; } public notice ( msg , ... args ) { this . delegate . notice ( this . versionAnnotation + ` ${ msg }` , ... args ) ; } public info ( msg , ... args ) { this . delegate . info ( this . versionAnnotation + ` ${ msg }` , ... args ) ; } public warn ( msg , ... args ) { this . delegate . warn ( this . versionAnnotation + ` ${ msg }` , ... args ) ; } public error ( msg , ... args ) { this . delegate . error ( this . versionAnnotation + ` ${ msg }` , ... args ) ; } public verbose ( msg , ... args ) { this . delegate . verbose ( this . versionAnnotation + ` ${ msg }` , ... args ) ; } public debug ( msg , ... args ) { this . delegate . debug ( this . versionAnnotation + ` ${ msg }` , ... args ) ; } public async sync ( ) { await this . delegate . sync ( ) ; } }