analogger 1.4.0 → 1.5.2
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/.nycrc +20 -0
- package/CHANGELOG.md +12 -0
- package/README.md +35 -7
- package/ci.md +0 -0
- package/dist/index-cjs.min.cjs +1 -1
- package/dist/index-esm.min.mjs +734 -2
- package/dist/index.css +47 -0
- package/package.json +22 -4
- package/.github/actions/checkout/action.yml +0 -10
- package/.github/workflows/test.yml +0 -24
- package/.github/workflows/versioning.yml +0 -25
- package/test/integration.cjs +0 -116
- package/test/unit.cjs +0 -455
package/dist/index.css
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.analogger {
|
|
2
|
+
background-color: #462210;
|
|
3
|
+
border: 4px solid #16122a;
|
|
4
|
+
box-shadow: 3px 4px 9px 0px rgba(0, 0, 0, 0.75);
|
|
5
|
+
height: 320px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
margin: 1rem;
|
|
8
|
+
padding: 13px 0 0 0;
|
|
9
|
+
width: 80%;
|
|
10
|
+
max-height: 300px;
|
|
11
|
+
}
|
|
12
|
+
.analogger .analogger-view {
|
|
13
|
+
background-color: #0c0c0c;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
color: antiquewhite;
|
|
16
|
+
display: block;
|
|
17
|
+
font-family: sans-serif;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
line-height: 30px;
|
|
20
|
+
height: calc(100% - 20px);
|
|
21
|
+
margin: 20px 0 0 0;
|
|
22
|
+
padding: 12px;
|
|
23
|
+
overflow: auto;
|
|
24
|
+
position: relative;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
.analogger .analogger-view::-webkit-scrollbar-thumb {
|
|
28
|
+
border: 5px solid transparent;
|
|
29
|
+
border-radius: 100px;
|
|
30
|
+
background-color: #514b6e;
|
|
31
|
+
background-clip: content-box;
|
|
32
|
+
}
|
|
33
|
+
.analogger .analogger-view::-webkit-scrollbar {
|
|
34
|
+
width: 20px;
|
|
35
|
+
}
|
|
36
|
+
.analogger .analogger-view::-webkit-scrollbar-track {
|
|
37
|
+
background-color: #382525;
|
|
38
|
+
border-radius: 100px;
|
|
39
|
+
}
|
|
40
|
+
.analogger .analogger-view::-webkit-scrollbar-thumb {
|
|
41
|
+
border-radius: 100px;
|
|
42
|
+
border: 4px solid transparent;
|
|
43
|
+
background-clip: content-box;
|
|
44
|
+
background-color: #9f6c53;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "analogger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Js Logger",
|
|
5
5
|
"main": "dist/index-cjs.min.cjs",
|
|
6
6
|
"module": "dist/index-esm.min.mjs",
|
|
@@ -17,12 +17,22 @@
|
|
|
17
17
|
"bundle:prod:cjs": "rollup --config rollup-cjs.config.js",
|
|
18
18
|
"bundle:prod:esm": "rollup --config rollup-esm.config.js",
|
|
19
19
|
"bundle:prod": "npm run convert-cjs:esm && npm run convert-cjs:browser && npm run bundle:prod:cjs && npm run bundle:prod:esm",
|
|
20
|
-
"test": "nyc mocha",
|
|
20
|
+
"test": "npm run bundle:prod && nyc mocha --exit --sort --retries 2",
|
|
21
|
+
"server:start": "http-server.cmd -c-1 -s -p 9880 ./ > log.log",
|
|
22
|
+
"manual:check": "http-server.cmd -c-1 -p 9877 -o example/index.html ./ ",
|
|
23
|
+
"manual:test": "concurrently --success first --kill-others \"npm run test\" \"npm run server:start\"",
|
|
21
24
|
"demo": "npm run bundle:prod && node example/cjs/demo.cjs"
|
|
22
25
|
},
|
|
23
26
|
"author": "Patrice Thimothee",
|
|
24
27
|
"license": "MIT",
|
|
25
28
|
"homepage": "https://github.com/thimpat/analogger/blob/main/README.md",
|
|
29
|
+
"keywords": [
|
|
30
|
+
"console",
|
|
31
|
+
"log",
|
|
32
|
+
"error",
|
|
33
|
+
"log analyser",
|
|
34
|
+
"productivity"
|
|
35
|
+
],
|
|
26
36
|
"repository": {
|
|
27
37
|
"type": "git",
|
|
28
38
|
"url": "https://github.com/thimpat/analogger.git"
|
|
@@ -43,15 +53,22 @@
|
|
|
43
53
|
"chai": "^4.3.6",
|
|
44
54
|
"chai-arrays": "^2.2.0",
|
|
45
55
|
"chai-spies": "^1.0.0",
|
|
56
|
+
"chromedriver": "^2.33.0",
|
|
57
|
+
"chromium": "^3.0.3",
|
|
58
|
+
"concurrently": "^7.0.0",
|
|
46
59
|
"eslint": "^8.8.0",
|
|
60
|
+
"http-server": "^14.1.0",
|
|
61
|
+
"jsdom": "19.0.0",
|
|
62
|
+
"jsdom-global": "3.0.2",
|
|
47
63
|
"mocha": "^9.2.0",
|
|
48
64
|
"nyc": "^15.1.0",
|
|
49
65
|
"rollup": "^2.67.0",
|
|
66
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
50
67
|
"rollup-plugin-delete": "^2.0.0",
|
|
51
68
|
"rollup-plugin-uglify": "^6.0.4",
|
|
52
69
|
"semantic-release": "^19.0.2",
|
|
53
70
|
"sinon": "^13.0.1",
|
|
54
|
-
"to-esm": "^1.6.
|
|
71
|
+
"to-esm": "^1.6.5"
|
|
55
72
|
},
|
|
56
73
|
"dependencies": {
|
|
57
74
|
"chalk": "^5.0.0",
|
|
@@ -59,6 +76,7 @@
|
|
|
59
76
|
"color-convert": "^2.0.1",
|
|
60
77
|
"color-convert-cjs": "npm:color-convert@^2.0.1",
|
|
61
78
|
"rgb-hex": "^4.0.0",
|
|
62
|
-
"rgb-hex-cjs": "npm:rgb-hex@^3.0.0"
|
|
79
|
+
"rgb-hex-cjs": "npm:rgb-hex@^3.0.0",
|
|
80
|
+
"selenium-webdriver": "^3.6.0"
|
|
63
81
|
}
|
|
64
82
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: Test
|
|
2
|
-
env:
|
|
3
|
-
ANALOGGER_APP_NAME: "release/analogger"
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
branches:
|
|
7
|
-
- "**"
|
|
8
|
-
paths-ignore:
|
|
9
|
-
- "**.md"
|
|
10
|
-
- ".vscode/**"
|
|
11
|
-
jobs:
|
|
12
|
-
set-version:
|
|
13
|
-
runs-on: [self-hosted]
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
- name: Check out Git repository
|
|
17
|
-
uses: thimpat/analogger/.github/actions/checkout@ci
|
|
18
|
-
- name: Install dependencies
|
|
19
|
-
shell: powershell
|
|
20
|
-
run: npm install
|
|
21
|
-
- name: Test
|
|
22
|
-
shell: powershell
|
|
23
|
-
run: |
|
|
24
|
-
npm test
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: Build
|
|
2
|
-
env:
|
|
3
|
-
ANALOGGER_APP_NAME: "release/analogger"
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
branches:
|
|
7
|
-
- main
|
|
8
|
-
- ci
|
|
9
|
-
paths-ignore:
|
|
10
|
-
- "**.md"
|
|
11
|
-
- ".vscode/**"
|
|
12
|
-
jobs:
|
|
13
|
-
set-version:
|
|
14
|
-
runs-on: [self-hosted]
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
- name: Check out Git repository
|
|
18
|
-
uses: thimpat/analogger/.github/actions/checkout@ci
|
|
19
|
-
- name: Install dependencies
|
|
20
|
-
shell: powershell
|
|
21
|
-
run: npm install
|
|
22
|
-
- name: Upgrade version
|
|
23
|
-
shell: powershell
|
|
24
|
-
run: |
|
|
25
|
-
npx semantic-release
|
package/test/integration.cjs
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
const chai = require("chai");
|
|
2
|
-
var capcon = require('capture-console');
|
|
3
|
-
const {anaLogger} = require("../src/cjs/ana-logger.cjs");
|
|
4
|
-
const {LOG_CONTEXTS, LOG_TARGETS} = require("../example/cjs/contexts-def.cjs");
|
|
5
|
-
const expect = chai.expect;
|
|
6
|
-
|
|
7
|
-
describe('In the Terminal', function ()
|
|
8
|
-
{
|
|
9
|
-
before(()=>
|
|
10
|
-
{
|
|
11
|
-
anaLogger.setContexts(LOG_CONTEXTS);
|
|
12
|
-
anaLogger.setTargets(LOG_TARGETS);
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
beforeEach(()=>
|
|
16
|
-
{
|
|
17
|
-
anaLogger.resetLogHistory()
|
|
18
|
-
anaLogger.keepLogHistory()
|
|
19
|
-
anaLogger.setOptions({silent: false, hideError: false})
|
|
20
|
-
anaLogger.removeOverride()
|
|
21
|
-
anaLogger.removeOverrideError()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
describe('AnaLogger', function ()
|
|
25
|
-
{
|
|
26
|
-
it('should emulate console.log', function ()
|
|
27
|
-
{
|
|
28
|
-
const captured = capcon.captureStdio(function ()
|
|
29
|
-
{
|
|
30
|
-
anaLogger.log(`Test Log example C1`);
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
expect(captured.stdout).to.contain(`Test Log example C1`)
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should hide console output when the console behaviour is overridden', function (done)
|
|
37
|
-
{
|
|
38
|
-
const captured = capcon.captureStdio(function ()
|
|
39
|
-
{
|
|
40
|
-
console.log(`Log Before override`);
|
|
41
|
-
anaLogger.setOptions({silent: true})
|
|
42
|
-
anaLogger.overrideConsole()
|
|
43
|
-
console.log(`Log After override`);
|
|
44
|
-
done()
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
expect(captured.stdout).to.contain(`Log Before override`)
|
|
48
|
-
expect(captured.stdout).to.not.contain(`Log After override`)
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should hide console output but keep console input in the log history', function ()
|
|
52
|
-
{
|
|
53
|
-
const captured1 = capcon.captureStdio(function ()
|
|
54
|
-
{
|
|
55
|
-
anaLogger.keepLogHistory();
|
|
56
|
-
anaLogger.setOptions({silent: true, hideError: false})
|
|
57
|
-
anaLogger.log(LOG_CONTEXTS.C1, `Test Log example something again`);
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const captured2 = capcon.captureStdio(function ()
|
|
61
|
-
{
|
|
62
|
-
console.log(anaLogger.getLogHistory())
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
expect(captured1.stdout).to.not.contain(`Test Log example something again`)
|
|
66
|
-
expect(captured2.stdout).to.contain(`Test Log example something again`)
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should hide console error when the console behaviour is overridden', function ()
|
|
70
|
-
{
|
|
71
|
-
const captured = capcon.captureStdio(function ()
|
|
72
|
-
{
|
|
73
|
-
console.log(`Log Before override`);
|
|
74
|
-
anaLogger.setOptions({hideError: true})
|
|
75
|
-
anaLogger.overrideConsole()
|
|
76
|
-
|
|
77
|
-
console.error(`Error Before override`);
|
|
78
|
-
anaLogger.overrideError()
|
|
79
|
-
console.error(`Error After override`);
|
|
80
|
-
|
|
81
|
-
console.log(`Log After override`);
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
expect(captured.stdout).to.contain(`Log Before override`)
|
|
85
|
-
expect(captured.stdout).to.not.contain(`Error After override`)
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should not show unrelated target logs', function ()
|
|
89
|
-
{
|
|
90
|
-
const captured = capcon.captureStdio(function ()
|
|
91
|
-
{
|
|
92
|
-
anaLogger.setActiveTarget(LOG_TARGETS.DEV3)
|
|
93
|
-
anaLogger.log({context: LOG_CONTEXTS.TEST, target: LOG_TARGETS.DEV3, lid: 100001}, `Test Log example with active target`);
|
|
94
|
-
anaLogger.log({context: LOG_CONTEXTS.TEST, target: LOG_TARGETS.DEV1, lid: 100002}, `Test Log example with DEV1 target`);
|
|
95
|
-
anaLogger.log(`Test Log example with DEFAULT target`);
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
expect(captured.stdout).to.contain(`Test Log example with active target`)
|
|
99
|
-
expect(captured.stdout).to.contain(`Test Log example with DEFAULT target`)
|
|
100
|
-
expect(captured.stdout).to.not.contain(`Test Log example with DEV1 target`)
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('should not anything when silent mode is enabled', function ()
|
|
104
|
-
{
|
|
105
|
-
const captured = capcon.captureStdio(function ()
|
|
106
|
-
{
|
|
107
|
-
anaLogger.setOptions({silent: true})
|
|
108
|
-
anaLogger.log(`Test Log example with DEFAULT target`);
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
expect(captured.stdout).to.not.contain(`Test Log example with DEFAULT target`)
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
});
|