scharff 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/index.js +12 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Scharff Logger
|
|
2
|
-
|
|
3
|
-
The project is using the fetch-intercept NPM package.
|
|
2
|
+
Scharff is a lightweight and versatile Node.js package designed to enhance your application's logging capabilities by seamlessly integrating a powerful outgoing request logger. With Scharff, you can effortlessly gain insights into the interactions your application has with external services, APIs, and resources.
|
|
4
3
|
|
|
5
4
|
## Installation
|
|
6
5
|
1) run `npm install scharff`.
|
|
@@ -32,8 +31,7 @@ The project is using the fetch-intercept NPM package.
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
## Next release
|
|
35
|
-
1)
|
|
36
|
-
2) Adding the IP address to the log.
|
|
34
|
+
1)
|
|
37
35
|
|
|
38
36
|
## Future additions
|
|
39
37
|
1) We will add a request error logger.
|
package/index.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
const fetchIntercept = require('fetch-intercept');
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const { removeBaseUrl } = require('./constants/functions');
|
|
4
|
+
const os = require('os');
|
|
4
5
|
|
|
5
6
|
module.exports.unregister = fetchIntercept.register({
|
|
6
7
|
request: function (url, config) {
|
|
8
|
+
const interfaces = os.networkInterfaces();
|
|
9
|
+
let addresses = [];
|
|
7
10
|
let tempUrl = url;
|
|
8
|
-
let
|
|
11
|
+
for (let i in interfaces) {
|
|
12
|
+
for (var i2 in interfaces[i]) {
|
|
13
|
+
var address = interfaces[i][i2];
|
|
14
|
+
if (address.family === 'IPv4' && !address.internal) {
|
|
15
|
+
addresses.push(address.address);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
let tempReq = { url, ip: addresses[0] };
|
|
9
20
|
let date = new Date().toLocaleString();
|
|
10
21
|
tempReq.date = date;
|
|
11
22
|
tempUrl = removeBaseUrl(tempUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scharff",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Logger for outgoing requests",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,10 @@
|
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "https://github.com/Minka1902/scharff.git"
|
|
24
24
|
},
|
|
25
|
-
"author":
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "Michael Scharff",
|
|
27
|
+
"email": "minka.scharff@gmail.com"
|
|
28
|
+
},
|
|
26
29
|
"license": "ISC",
|
|
27
30
|
"dependencies": {
|
|
28
31
|
"fetch-intercept": "^2.4.0"
|