I am facing an issue with my layout component where I am trying to inject a service, but it is coming up as undefined in my code snippet below:
import {BaseLayout, LogEvent, Layout} from "ts-log-debug";
import {formatLogData} from "@tsed/common/node_modules/ts-log-debug/lib/layouts/utils/inspectUtils.js";
import { StorageService } from './StorageService';
import { IBasicLayoutConfiguration } from "@tsed/common/node_modules/ts-log-debug/lib/layouts/interfaces/BasicLayoutConfiguration";
@Layout({name: "customJson"})
export class JsonLayout extends BaseLayout {
constructor(config : IBasicLayoutConfiguration , private storageService : StorageService) {
super(config);
}
transform(loggingEvent: LogEvent, timezoneOffset?): string {
const log = {
Id:{ Id: () => {
return this.storageService && this.storageService.getId() || '';
},
},
context: context
};
log.data = log.data.map((data) => formatLogData([data]));
return JSON.stringify(log) + (this.config["separator"] || "");
};
}
The service is included in the providers array within the app.module.ts file. Can anyone help identify what could be causing this issue?