loglevel implemention - thoughts?



  • All, I’ve implemented loglevel - https://github.com/pimterry/loglevel - within my Quasar application.

    Here’s my very simple boot file:

    import loglevel from 'loglevel';
    
    const isDevelopment = process.env.NODE_ENV === 'development';
    loglevel.setLevel(isDevelopment ? 'debug' : 'error', false);
    
    window.console = loglevel;
    

    So, all I’m doing is swapping out the window.console for loglevel. It works great in my application, I can use console.log(), console.error(), and all of the other console functions. Messages are filtered by environment and the module supports a bunch of other nice stuff (like plugins).

    Is this a satisfactory way to implement this module?


Log in to reply