ac-logger 1.3.2 → 2.0.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/.eslintrc.js +1 -1
- package/.github/workflows/node.js.yml +29 -0
- package/CHANGELOG.md +22 -0
- package/README.md +3 -2
- package/index.js +2 -2
- package/package.json +7 -6
- package/test/test.js +26 -3
package/.eslintrc.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Node.js CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ master, develop ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ master, develop ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
node-version: [16.x, 18.x]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v3
|
|
23
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
24
|
+
uses: actions/setup-node@v3
|
|
25
|
+
with:
|
|
26
|
+
node-version: ${{ matrix.node-version }}
|
|
27
|
+
|
|
28
|
+
- run: yarn install
|
|
29
|
+
- run: yarn run test
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
<a name="2.0.0"></a>
|
|
2
|
+
|
|
3
|
+
# [2.0.0](https://github.com/admiralcloud/ac-logger/compare/v1.3.2..v2.0.0) (2023-03-09 18:18:08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Feature
|
|
7
|
+
|
|
8
|
+
* **App:** Package updates | MP | [a922b1fc6a73c866315951269bcb8ffb17bab346](https://github.com/admiralcloud/ac-logger/commit/a922b1fc6a73c866315951269bcb8ffb17bab346)
|
|
9
|
+
Package updates
|
|
10
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
11
|
+
### Bug Fix
|
|
12
|
+
|
|
13
|
+
* **App:** Add branch to bootstrapInfo | MP | [2cf0f48c5ac9c954c8dae8e705ce14a87d8439c7](https://github.com/admiralcloud/ac-logger/commit/2cf0f48c5ac9c954c8dae8e705ce14a87d8439c7)
|
|
14
|
+
Add branch to bootstrapInfo
|
|
15
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
16
|
+
### Tests
|
|
17
|
+
|
|
18
|
+
* **App:** Added first test | MP | [cd44af0721256f9e72253ed307e0b80f15af7312](https://github.com/admiralcloud/ac-logger/commit/cd44af0721256f9e72253ed307e0b80f15af7312)
|
|
19
|
+
First test
|
|
20
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
21
|
+
## BREAKING CHANGES
|
|
22
|
+
* **App:** Node 16+ required
|
|
1
23
|
<a name="1.3.2"></a>
|
|
2
24
|
|
|
3
25
|
## [1.3.2](https://github.com/admiralcloud/ac-logger/compare/v1.3.1..v1.3.2) (2023-02-02 19:04:00)
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@ Unified logging function for all backend applications of AdmiralCloud. Use it in
|
|
|
3
3
|
|
|
4
4
|
The purpose of the little app is to make sure that all applications use the same log format/notations.
|
|
5
5
|
|
|
6
|
+
[](https://github.com/AdmiralCloud/ac-logger/actions/workflows/node.js.yml)
|
|
7
|
+
|
|
6
8
|
## Usage
|
|
7
9
|
Use it like Winston!
|
|
8
10
|
|
|
@@ -81,8 +83,7 @@ TBC
|
|
|
81
83
|
|
|
82
84
|
## Links
|
|
83
85
|
- [Website](https://www.admiralcloud.com/)
|
|
84
|
-
- [Twitter (@admiralcloud)](https://twitter.com/admiralcloud)
|
|
85
86
|
- [Facebook](https://www.facebook.com/MediaAssetManagement/)
|
|
86
87
|
|
|
87
88
|
## License
|
|
88
|
-
[MIT License](https://opensource.org/licenses/MIT) Copyright © 2009-present, AdmiralCloud, Mark Poepping
|
|
89
|
+
[MIT License](https://opensource.org/licenses/MIT) Copyright © 2009-present, AdmiralCloud AG, Mark Poepping
|
package/index.js
CHANGED
|
@@ -96,16 +96,16 @@ module.exports = (config) => {
|
|
|
96
96
|
acLogger.info(_.repeat('-', length))
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const bootstrapInfo = (
|
|
99
|
+
const bootstrapInfo = ({ appName = 'App name missing', branch }) => {
|
|
100
100
|
const pwd = process.cwd()
|
|
101
101
|
const pjson = require(path.resolve(pwd, 'package.json'))
|
|
102
102
|
const environment = process.env.NODE_ENV || 'development'
|
|
103
|
-
const appName = _.get(params, 'appName', 'App name missing')
|
|
104
103
|
const padLength = 15
|
|
105
104
|
acLogger.info('')
|
|
106
105
|
hrLine()
|
|
107
106
|
listing({ field: 'Time', value: moment().format('YYYY-MM-DD HH:mm:ss'), padLength })
|
|
108
107
|
listing({ field: 'Environment', value: environment, padLength })
|
|
108
|
+
if (branch) listing({ field: 'Branch', value: branch, padLength })
|
|
109
109
|
listing({ field: 'Version', value: pjson.version, padLength })
|
|
110
110
|
listing({ field: 'AppName', value: appName, padLength })
|
|
111
111
|
acLogger.info('')
|
package/package.json
CHANGED
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
"author": "Mark Poepping (https://www.admiralcloud.com)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "admiralcloud/ac-logger",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "2.0.0",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"lodash": "^4.17.21",
|
|
9
9
|
"moment": "^2.29.4",
|
|
10
10
|
"winston": "^3.8.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"ac-semantic-release": "^0.3.
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"ac-semantic-release": "^0.3.5",
|
|
14
|
+
"chai": "^4.3.7",
|
|
15
|
+
"eslint": "^8.35.0",
|
|
16
|
+
"intercept-stdout": "^0.1.2",
|
|
17
|
+
"mocha": "^10.2.0",
|
|
17
18
|
"mocha-jenkins-reporter": "^0.4.8"
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
@@ -21,6 +22,6 @@
|
|
|
21
22
|
"test-jenkins": "JUNIT_REPORT_PATH=./report.xml mocha --colors --reporter mocha-jenkins-reporter --reporter-options junit_report_name='ACLogger'"
|
|
22
23
|
},
|
|
23
24
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
25
|
+
"node": ">=16.0.0"
|
|
25
26
|
}
|
|
26
27
|
}
|
package/test/test.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
const { expect } = require('chai')
|
|
2
|
+
const aclog = require('../index')
|
|
3
|
+
|
|
4
|
+
var intercept = require("intercept-stdout");
|
|
5
|
+
|
|
6
|
+
var captured_text = "";
|
|
7
|
+
|
|
8
|
+
var unhook_intercept = intercept(function(text) {
|
|
9
|
+
captured_text += text;
|
|
10
|
+
});
|
|
2
11
|
|
|
3
12
|
describe('Tests', () => {
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
it('Check bootstrapInfo', () => {
|
|
16
|
+
aclog().bootstrapInfo({ appName: 'myApp', branch: 'myBranch' })
|
|
17
|
+
const lines = captured_text.split('\n')
|
|
18
|
+
expect(lines[5]).to.contain('Time')
|
|
19
|
+
expect(lines[6]).to.contain('Environment')
|
|
20
|
+
expect(lines[7]).to.contain('Branch')
|
|
21
|
+
expect(lines[7]).to.contain('myBranch')
|
|
22
|
+
expect(lines[8]).to.contain('Version')
|
|
23
|
+
expect(lines[9]).to.contain('AppName')
|
|
24
|
+
expect(lines[9]).to.contain('myApp')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('Unhook', () => {
|
|
28
|
+
unhook_intercept()
|
|
6
29
|
})
|
|
7
30
|
})
|