Situation
We want to add this external logging JS lib to our Discourse Instance to improve the debugging workflow by using this lightweight logging wrapper that allows us for example setting up a logLevel via log.setLevel('debug')
.
This external lib should be available throughout all our custom plugins, Theme and Theme Components we have installed on our App.
Implementation
• Would importing the JS via register_asset
in various Plugins import the JS file multiple times?
• Is there an alternative JS lib with similar functionality after Ember deprecated its logging utility in favor of console.log
We currently went down following road to implement it.
- Install Plugin which imports external JS and make JS lib available via window object (`window.log = log’)
• Import JS lib only once imported
• Other plugins/Theme/Theme Components would depend on that Plugin and things like open source plugins would force users to install both plugins
Does this make sense or would you suggest a different approach?