馃攷 Search Terms
typescript,info,logger
The problem
README.md is clear that the following syntax is legal:
logger.info('Hello world')
However I cannot get this to work with Typescript.
Versions:
Winston version: 3.10.0
Node version: v20.5.1
Example:
Using "esModuleInterop": true in tsconfig.json to allow the use of Winston using import syntax:
import { Logger, transports, format } from 'winston'
const logger = new Logger({
level: 'debug',
transports: [new transports.Console()],
format: format.combine(format.splat(), format.colorize({ all: true }), format.simple())
})
logger.info('Hello world')
export default logger
Expected:
Console output of: Hello world
Actual:
logger_1.default.info is not a function
What version of Winston presents the issue?
3.10.0
What version of Node are you using?
20.5.1
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
Using "esModuleInterop": true in tsconfig.json to allow the use of Winston using import syntax:
import { Logger, transports, format } from 'winston'
const logger = new Logger({
level: 'debug',
transports: [new transports.Console()],
format: format.combine(format.splat(), format.colorize({ all: true }), format.simple())
})
logger.info('Hello world')
export default logger
Additional information
No response
馃攷 Search Terms
typescript,info,logger
The problem
README.md is clear that the following syntax is legal:
logger.info('Hello world')However I cannot get this to work with Typescript.
Versions:
Winston version:
3.10.0Node version:
v20.5.1Example:
Using
"esModuleInterop": trueintsconfig.jsonto allow the use of Winston usingimportsyntax:Expected:
Console output of: Hello world
Actual:
logger_1.default.info is not a function
What version of Winston presents the issue?
3.10.0
What version of Node are you using?
20.5.1
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
Using
"esModuleInterop": trueintsconfig.jsonto allow the use of Winston usingimportsyntax:Additional information
No response