New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

anylogger

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anylogger - npm Package Compare versions

Comparing version

to
0.17.0

27

anylogger.js

@@ -39,6 +39,16 @@ /**

* To be compliant with the anylogger API, loggers should support at least
* the default levels through the like named log functions, but they may
* define additional levels and they may choose to use different numeric values
* the log methods corresponding to the default levels, but they may define
* additional levels and they may choose to use different numeric values
* for all the levels.
*
* The guarantees the Anylogger API makes are:
* - there is a logging method corresponding to each level listed in anylogger.levels
* - the levels error, warn, info, log, debug and trace are always there
* - each level corresponds to a numeric value
*
* Note that the Anylogger API explicitly does not guarantee that all levels
* have distinct values or that the numeric values will follow any pattern
* or have any specific order. For this reason it is best to think of levels
* as separate log channels, possibly going to different output locations.
*
* You can replace or change this object to include levels corresponding with

@@ -55,4 +65,7 @@ * those available in the framework you are writing an adapter for. Please

*
* Called when a logger needs to be created.
* Creates a new logger, then extends it by calling `anylogger.ext` on the result.
* Creates a new logger function that calls `anylogger.log` when invoked.
*
* Uses some evil eval trickery to create a named function so that function.name
* corresponds to the module name given. Polyfills function.name on platforms
* where it is not natively available.
*

@@ -62,3 +75,3 @@ * @param name {String} The name of the logger to create

*
* @returns A new logger with the given `name` and `config`.
* @returns A new logger function with the given `name`.
*/

@@ -95,7 +108,7 @@ a.new = function(n,c,r) {

/**
* `anylogger.ext(logger) => logger`
*
* Called when a logger needs to be extended, either because it was newly
* created, or because it's configuration or settings changed in some way.
*
* `anylogger.ext(logger) => logger`
*
* This method must ensure that a log method is available on the logger for

@@ -102,0 +115,0 @@ * each level in `anylogger.levels`.

{
"name": "anylogger",
"version": "0.16.0",
"version": "0.17.0",
"description": "Get a logger. Any logger.",

@@ -5,0 +5,0 @@ "main": "anylogger.js",

@@ -1,2 +0,2 @@

# anylogger <sub><sup>0.16.0</sup></sub>
# anylogger <sub><sup>0.17.0</sup></sub>
### Get a logger. Any logger.

@@ -67,5 +67,5 @@

* [anylogger.js](https://unpkg.com/anylogger@0.16.0/anylogger.js)
* [anylogger.js](https://unpkg.com/anylogger@0.17.0/anylogger.js)
(fully commented source ~5kB)
* [anylogger.min.js](https://unpkg.com/anylogger@0.16.0/anylogger.min.js)
* [anylogger.min.js](https://unpkg.com/anylogger@0.17.0/anylogger.min.js)
(minified 546 bytes, gzipped ~[350](#gzip-size) bytes)

@@ -78,3 +78,3 @@

```html
<script src="https://unpkg.com/anylogger@0.16.0/anylogger.min.js"></script>
<script src="https://unpkg.com/anylogger@0.17.0/anylogger.min.js"></script>
<script>(function(){ // IIFE

@@ -107,3 +107,3 @@ var log = anylogger('index.html')

"peerDependencies": {
"anylogger": "^0.16.0"
"anylogger": "^0.17.0"
}

@@ -362,6 +362,16 @@ }

To be compliant with the anylogger API, loggers should support at least
the default levels through the like named log functions, but they may
define additional levels and they may choose to use different numeric values
the log methods corresponding to the default levels, but they may define
additional levels and they may choose to use different numeric values
for all the levels.
The guarantees the Anylogger API makes are:
* there is a logging method corresponding to each level listed in `anylogger.levels`
* the levels `error`, `warn`, `info`, `log`, `debug` and `trace` are always there
* each level corresponds to a numeric value
Note that the Anylogger API explicitly does not guarantee that all levels
have distinct values or that the numeric values will follow any pattern
or have any specific order. For this reason it is best to think of levels
as separate log channels, possibly going to different output locations.
You can replace or change this object to include levels corresponding with

@@ -377,4 +387,7 @@ those available in the framework you are writing an adapter for. Please

```
A method that is called to create the logger function.
Calls `anylogger.ext` on the created log function before returning it.
Creates a new logger function that calls `anylogger.log` when invoked.
Uses some evil eval trickery to create a named function so that function.name
corresponds to the module name given. Polyfills function.name on platforms
where it is not natively available.

@@ -387,3 +400,4 @@ ##### name

You can chain this method and include any one-time customizations here:
Instead of completely trying to replace the original method, I recommend you
chain it to include your one-time customizations like this:

@@ -414,5 +428,12 @@ ```js

```
A method that is called to extend the logger function. May be called multiple
times on the same logger function.
Called when a logger needs to be extended, either because it was newly
created, or because it's configuration or settings changed in some way.
This method must ensure that a log method is available on the logger for
each level in `anylogger.levels`.
When overriding `anylogger.ext`, please ensure the function can safely
be called multiple times on the same object
##### logger

@@ -443,3 +464,3 @@ The logger that should be (re-)extended. Function. Required.

Please have a look at the
[source](https://unpkg.com/anylogger@0.16.0/anylogger.js)
[source](https://unpkg.com/anylogger@0.17.0/anylogger.js)
it should make it more clear how to write an adapter. Also consider studying

@@ -446,0 +467,0 @@ the [available adapters](https://www.npmjs.com/search?q=keywords:anylogger)