Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / loglevel / README.md
index aaad1b0b88fae8c101ea8ce2c0cfc79faca78a52..e3ec5c1371dd14bef56098de49b0faf2d05b14a5 100644 (file)
@@ -4,6 +4,8 @@
 [npm-image]: https://img.shields.io/npm/v/loglevel.svg?style=flat
 [npm-url]: https://npmjs.org/package/loglevel
 
+> _Don't debug with logs alone - check out [HTTP Toolkit](https://httptoolkit.tech/javascript): beautiful, powerful & open-source tools for building, testing & debugging HTTP(S)_
+
 Minimal lightweight simple logging for JavaScript. loglevel replaces console.log() and friends with level-based logging and filtering, with none of console's downsides.
 
 This is a barebones reliable everyday logging library. It does not do fancy things, it does not let you reconfigure appenders or add complex log filtering rules or boil tea (more's the pity), but it does have the all core functionality that you actually use:
@@ -75,22 +77,24 @@ log.warn("too easy");
 
 ### As an ES6 module:
 
-loglevel is written as a UMD module, with a single object exported. ES6 module loaders & transpilers don't all handle this the same way. Some will treat the object as the default export, while others use it as the root exported object. Here are the two cases:
+loglevel is written as a UMD module, with a single object exported. Unfortunately ES6 module loaders & transpilers don't all handle this the same way. Some will treat the object as the default export, while others use it as the root exported object. In addition, loglevel includes `default` property on the root object, designed to help handle this differences. Nonetheless, there's two possible syntaxes that might work for you:
 
-For tools like TypeScript and Browserify, which treat root exports as the root value of the module:
+For most tools, using the default import is the most convenient and flexible option:
 
 ```javascript
-import * as log from 'loglevel';
+import log from 'loglevel';
 log.warn("module-tastic");
 ```
 
-For tools like Babel, and Node.js's [experimental ESM support](https://nodejs.org/api/esm.html), which treat root exports as the default export of the module:
+For some tools though, it might better to wildcard import the whole object:
 
 ```javascript
-import log from 'loglevel';
+import * as log from 'loglevel';
 log.warn("module-tastic");
 ```
 
+There's no major difference, unless you're using TypeScript & building a loglevel plugin (in that case, see https://github.com/pimterry/loglevel/issues/149). In general though, just use whichever suits your environment, and everything should work out fine.
+
 ### With noConflict():
 
 If you're using another JavaScript library that exposes a 'log' global, you can run into conflicts with loglevel.  Similarly to jQuery, you can solve this by putting loglevel into no-conflict mode immediately after it is loaded onto the page. This resets to 'log' global to its value before loglevel was loaded (typically `undefined`), and returns the loglevel object, which you can then bind to another name yourself.
@@ -155,7 +159,7 @@ The loglevel API is extremely minimal. All methods are available on the root log
 
 * A `log.setDefaultLevel(level)` method.
 
-  This sets the current log level only if one has not been persisted and can’t be loaded. This is useful when initializing scripts; if a developer or user has previously called `setLevel()`, this won’t alter their settings. For example, your application might set the log level to `error` in a production environment, but when debugging an issue, you might call `setLevel("trace")` on the console to see all the logs. If that `error` setting was set using `setDefaultLevel()`, it will still say as `trace` on subsequent page loads and refreshes instead of resetting to `error`.
+  This sets the current log level only if one has not been persisted and can’t be loaded. This is useful when initializing scripts; if a developer or user has previously called `setLevel()`, this won’t alter their settings. For example, your application might set the log level to `error` in a production environment, but when debugging an issue, you might call `setLevel("trace")` on the console to see all the logs. If that `error` setting was set using `setDefaultLevel()`, it will still stay as `trace` on subsequent page loads and refreshes instead of resetting to `error`.
 
   The `level` argument takes is the same values that you might pass to `setLevel()`. Levels set using `setDefaultLevel()` never persist to subsequent page loads.
 
@@ -185,7 +189,7 @@ The loglevel API is extremely minimal. All methods are available on the root log
 
 * A `log.getLogger(loggerName)` method.
 
-  This gets you a new logger object that works exactly like the root `log` object, but can have its level and logging methods set independently. All loggers must have a name (which is a non-empty string). Calling `getLogger()` multiple times with the same name will return an identical logger object.
+  This gets you a new logger object that works exactly like the root `log` object, but can have its level and logging methods set independently. All loggers must have a name (which is a non-empty string, or a [Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)). Calling `getLogger()` multiple times with the same name will return an identical logger object.
 
   In large applications, it can be incredibly useful to turn logging on and off for particular modules as you are working with them. Using the `getLogger()` method lets you create a separate logger for each part of your application with its own logging level.
 
@@ -220,7 +224,7 @@ The loglevel API is extremely minimal. All methods are available on the root log
 
   Loggers returned by `getLogger()` support all the same properties and methods as the default root logger, excepting `noConflict()` and the `getLogger()` method itself.
 
-  Like the root logger, other loggers can have their logging level saved. If a logger’s level has not been saved, it will inherit the root logger’s level when it is first created. If the root logger’s level changes later, the new level will not affect other loggers that have already been created.
+  Like the root logger, other loggers can have their logging level saved. If a logger’s level has not been saved, it will inherit the root logger’s level when it is first created. If the root logger’s level changes later, the new level will not affect other loggers that have already been created. Loggers with Symbol names (rather than string names) will be always considered as unique instances, and will never have their logging level saved or restored.
 
   Likewise, loggers will inherit the root logger’s `methodFactory`. After creation, each logger can have its `methodFactory` independently set. See the *plugins* section below for more about `methodFactory`.
 
@@ -238,12 +242,6 @@ The loglevel API is extremely minimal. All methods are available on the root log
 
 ServerSend - https://github.com/artemyarulin/loglevel-serverSend - Forward your log messages to a remote server.
 
-Standard Streams - https://github.com/NatLibFi/loglevel-std-streams - Route logging through STDERR in Node for easier log management.
-
-Message Prefix - https://github.com/NatLibFi/loglevel-message-prefix - Dynamic (timestamp/level) and static ('foo') message prefixing.
-
-Message Buffer - https://github.com/NatLibFi/loglevel-message-buffer - Buffer messages, and flush them on-demand later.
-
 DEBUG - https://github.com/vectrlabs/loglevel-debug - Control logging from a DEBUG environmental variable (similar to the classic [Debug](https://github.com/visionmedia/debug) module)
 
 ### Writing plugins:
@@ -341,6 +339,10 @@ v1.6.7 - Fix a bug in environments with `window` defined but no `window.navigato
 
 v1.6.8 - Update TypeScript type definitions to include `log.log()`.
 
+v1.7.0 - Add support for Symbol-named loggers, and a `.default` property to help with ES6 module usage.
+
+v1.7.1 - Update TypeScript types to support Symbol-named loggers.
+
 ## `loglevel` for enterprise
 
 Available as part of the Tidelift Subscription.