Winston 3 console transport (and base transport) not working in the browser
See original GitHub issuePlease tell us about your environment:
winston
version?-
winston@2
-
winston@3
-
node -v
outputs: 8.11.1- Operating System? macOS
- Language? JS, ES6+
What is the problem?
Am I right in thinking that Winston 3 is aiming to be compatible in Node and the browser? If so, the browser throws up on setImmediate
, as it’s a native Node thing. Currently, setImmediate is recommended to use this within new transports, so I can’t quite see how this can work.
To re-produce:
Init somewhere:
import { createLogger, transports } from 'winston'
const consoleTransport = new transports.Console({ handleExceptions: true })
const logger = createLogger({
transports: [ consoleTransport ]
})
export default logger
Import and use somewhere in client-side code:
import logger from './logger'
logger.info('message for the browser console')
What do you expect to happen instead?
The browser console to log out the message
Sorry if I’m missing something here!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:11 (2 by maintainers)
Top Results From Across the Web
A Complete Guide to Winston Logging in Node.js - Better Stack
The following transport options are available in Winston by default: Console: output logs to the Node.js console. File: store log messages to one...
Read more >Node.js Logging with Winston - Reflectoring
We've been using the Console transport by default to display log messages. Let's look at how to use the File option. Storing Winston...
Read more >Can Winston Logger be used on the front-end for logging?
Yeah it is possible, however default transport for browser is very limited.
Read more >Logging with Winston and Node.js - Section.io
Winston allows you to implement multiple logging transports, i.e., a log can be recorded to a file, console, or database. The Logger ...
Read more >winston-transport-browserconsole - npm package - Snyk
BrowserConsole transport for winston logger. ... Latest version published 3 years ago. License: MIT ... security. No known security issues. popularity.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sneko I just installed
setImmediate
through npm: https://github.com/YuzuJS/setImmediate, then included it in my webpack bundle by importing it:Then it’s patched and available globally, on the
window
object+1 on this issue in “winston”: “3.3.3”