Best practices for logging?



  • Hi there

    I just wondered how to go about logging in Quasar and/or Vue. I have found very little documentation so far.

    Is there a tested/proven approach to setting up logging to be used in development as well as production?

    Cheers,
    M.



  • I would like to second this question, and see if the popular logger Winston would be recommended with Quasar (SPA mainly), or something else. Update 11/15/20: Winston looks like a good solution for Electron: just npm install winston and code below works:
    // winston logger 11/15/20
    import { createLogger, format, transports } from ‘winston’
    const logger = createLogger({
    level: ‘info’,
    defaultMeta: { service: ‘user-service’ },
    format: format.combine(
    format.timestamp({
    format: ‘YYYY-MM-DD HH🇲🇲ss’
    }),
    // format.errors({ stack: true}),
    format.splat(),
    format.json()
    ),
    transports: [
    new transports.File({ filename: ‘C:/temp/templog.log’, level: ‘info’})
    ]
    })
    logger.log(‘info’, ‘Hello, World of Winston Logging!’)
    logger.info(‘Hello, again, World of Winston Logging!’)

    output line: {“message”:“Hello, again, World of Winston Logging!”,“level”:“info”,“service”:“user-service”,“timestamp”:“2020-11-15 20:25:57”}



  • @mboeni nice question. My ideal logger:

    • would be implemented as web worker (it will not be a burden for main browser thread)
    • should write data to local indexeddb and then sync (when online) with logging backend service (because even if not online you should have a possibility to log events and review them later)
    • should have a possibility to implement plugins for example mouse position heat maps, touch gestures, eye movement, browser capabilities etc.
    • the sync protocol should be open so there will be at least one open source backend server in nodejs or python-fastapi and at least one commercial backend with extended analytics etc.
    • should have tons of examples, snippets and demos
    • should have quasar app extension for… something (?) ok - quasar integration out of the box would be really, really nice


  • Also very interested in a good logging solution which implements as a web worker


Log in to reply