Comments (6)
Adding a what...?! Don't leave me hanging!
from js-logger.
Oops, forgot to wrap <script>
in code back ticks. Edited original comment.
from js-logger.
+1 on this please!
I'd love to load into my modules in require.js but can't work out how to do it :-(
from js-logger.
You just need to make a require
call for the js-logger
module:
// CommonJS import
var jsLogger = require('js-logger');
// Usage.
var namedLogger = jsLogger.get('named-logger');
namedLogger.info("hello world!")
If you are using ES6 modules, you can use the import
keyword:
import jsLogger from 'js-logger';
I have personally used JSLogger with browserify and webpack; I'm pretty sure I had it working with requirejs back in the day (:
from js-logger.
Thanks for reply, so I guess I should be using either browserify or webpack ;-)
However, and this is probably more a lack of understanding about how requirejs works...
How do I set useDefaults() on the logger in my main.js and then have that setting persist on instances of the logger I require into my modules?
The only way I could make it work was by creating a wrapper module around jslogger which has a getter to retrieve the logger instance but I'm guessing that is not what I'm supposed to be doing?
from js-logger.
If requirejs works the same as browserify and webpack; then modules are statically imported (in the java sense), so mutations made in one place will be picked up elsewhere, ie: you can import jsLogger in your entrypoint and invoke useDefaults()
after which all subsequent invocation of jsLogger will be configured accordingly.
from js-logger.
Related Issues (20)
- setLevel(String) HOT 2
- Request for giving access to time variable in Logger.timeEnd() HOT 1
- Formatting example breaks console substition HOT 5
- Please packed a esm version, standalone file. HOT 1
- setLevel doesn't seem to work HOT 6
- How to remove stacktrace from trace logs? HOT 1
- Uncaught TypeError: Cannot read properties of undefined (reading 'Logger')
- export ILogger interface HOT 2
- Logging into plain text files HOT 1
- Debug Level Not Showing Up HOT 1
- Migrate away from gulp HOT 1
- Request for tables HOT 1
- No DEMO link in readme HOT 3
- npm package 1.4.1 has different code from github HOT 1
- The 1.5.0 version does not work with typescript 3.1.3 (EDIT 1.4.1 works) HOT 5
- Add missing TRACE debug level in ts definitions
- Request for api to set log-level of the Profile calls HOT 1
- When logging the line number comes from the logger instead the file where the logger is used HOT 1
- How do I extend the logger? HOT 1
- yarn? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-logger.