const defaultLogger = container.resolve<Logger>("logger"); const applicationStartupLogger = defaultLogger.child({ meta: { context: "Node.js server", subcontext: "Application startup" }, }); const someControllerLogger = defaultLogger.child({ meta: { context: "Node.js server", subcontext: "Some controller" }, }); defaultLogger.info("Some default logger logging with object placeholder logging a number %d", 3.14); > {"@timestamp":"2022-06-13T21:25:53.406Z","@version":1,"application":"express-boilerplate","message":"Some default logger logging with object placeholder logging a number 3.14","severity":"info","type":"stdin"} applicationStartupLogger.info("Starting server with data %o. Logged with child logger", { port, name: "Sample app" }); > {"@timestamp":"2022-06-13T21:25:53.422Z","@version":1,"application":"express-boilerplate","message":"Starting server with data { port: '1337', name: 'Sample app' }. Logged with child logger","meta":{"context":"Node.js server","subcontext":"Application startup"},"severity":"info","type":"stdin"} applicationStartupLogger.info("Now the app is ready 100%"); > {"@timestamp":"2022-06-13T21:25:53.422Z","@version":1,"application":"express-boilerplate","message":"Now the app is ready 100%","meta":{"context":"Node.js server","subcontext":"Application startup"},"severity":"info","type":"stdin"} someControllerLogger.info("Meanwhile in a controller I am logging a request object %o", req); > {"@timestamp":"2022-06-13T21:25:53.423Z","@version":1,"application":"express-boilerplate","message":"Meanwhile in a controller I am logging a request object {\n body: { withdraw: { amount: 123, currency: 'EUR' } },\n params: { id: '12345' }\n}","meta":{"context":"Node.js server","subcontext":"Some controller"},"severity":"info","type":"stdin"}