ac-logger 3.0.4 → 4.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.
@@ -0,0 +1,9 @@
1
+ # Code Owners
2
+ #
3
+ # This file defines who is responsible for code in this repository.
4
+ # Reviews from code owners are automatically requested for pull requests.
5
+ #
6
+ # More info: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
7
+
8
+ # Default owner for everything in the repo
9
+ * @AdmiralCloud/ac-maintainer-backend
@@ -1,29 +1,24 @@
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
1
  name: Node.js CI
5
2
 
6
3
  on:
7
4
  push:
8
- branches: [ master, develop ]
5
+ branches: [develop, master]
9
6
  pull_request:
10
- branches: [ master, develop ]
7
+ branches: [develop, master]
11
8
 
12
9
  jobs:
13
10
  build:
14
-
11
+ permissions:
12
+ contents: read
15
13
  runs-on: ubuntu-latest
16
-
17
14
  strategy:
18
15
  matrix:
19
- node-version: [16.x, 18.x]
20
-
16
+ node-version: [22.x, 24.x]
21
17
  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
18
+ - uses: actions/checkout@v4
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ - run: yarn install
24
+ - run: yarn run test
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ # [4.0.0](https://github.com/admiralcloud/ac-logger/compare/v3.0.5..v4.0.0) (2026-04-04 13:14:46)
2
+
3
+
4
+ ### Bug Fix
5
+
6
+
7
+ * **App:** Package updates | MP | [5361eb16cb8b8320b9416785f1e68f9e832ec391](https://github.com/admiralcloud/ac-logger/commit/5361eb16cb8b8320b9416785f1e68f9e832ec391)
8
+ Package updates
9
+ Related issues:
10
+ * **Misc:** Requires Node 22+ | MP | [70a30278e37136a924ed67254071b66b55738772](https://github.com/admiralcloud/ac-logger/commit/70a30278e37136a924ed67254071b66b55738772)
11
+ Requires Node 22+
12
+ Related issues:
13
+ ### Style
14
+
15
+
16
+ * **App:** Lint-fix | MP | [b93791fc3dbce7d7f0ed5f27c78711644b8bd88b](https://github.com/admiralcloud/ac-logger/commit/b93791fc3dbce7d7f0ed5f27c78711644b8bd88b)
17
+ Lint-fix
18
+ Related issues:
19
+ ### Chores
20
+
21
+
22
+ * **App:** Updated workflows | MP | [9a71ac0964bfb761cec4d770cd510eda46067e4a](https://github.com/admiralcloud/ac-logger/commit/9a71ac0964bfb761cec4d770cd510eda46067e4a)
23
+ Updated workflows
24
+ Related issues:
25
+ ## BREAKING CHANGES
26
+ * **Misc:** Requires Node 22+
27
+
28
+ ## [3.0.5](https://github.com/admiralcloud/ac-logger/compare/v3.0.4..v3.0.5) (2026-04-01 08:28:30)
29
+
30
+
31
+ ### Bug Fix
32
+
33
+ * **App:** Package updates | MP | [8dbcfb07d26aeb8bc30a63be73eb5ff603ecd13e](https://github.com/admiralcloud/ac-logger/commit/8dbcfb07d26aeb8bc30a63be73eb5ff603ecd13e)
34
+ Packagte updates
35
+ Related issues:
1
36
 
2
37
  ## [3.0.4](https://github.com/admiralcloud/ac-logger/compare/v3.0.3..v3.0.4) (2026-01-23 08:23:14)
3
38
 
package/README.md CHANGED
@@ -3,7 +3,7 @@ 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
- [![Node.js CI](https://github.com/AdmiralCloud/ac-logger/actions/workflows/node.js.yml/badge.svg)](https://github.com/AdmiralCloud/ac-logger/actions/workflows/node.js.yml)
6
+ [![Node.js CI](https://github.com/AdmiralCloud/ac-logger/actions/workflows/node.js.yml/badge.svg)](https://github.com/AdmiralCloud/ac-logger/actions/workflows/node.js.yml) [![CodeQL](https://github.com/AdmiralCloud/ac-logger/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/AdmiralCloud/ac-logger/actions/workflows/github-code-scanning/codeql)
7
7
 
8
8
  ## Usage
9
9
  Use it like Winston!
package/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We only provide security updates for the latest version of this project.
6
+
7
+ If you are using an older version, please upgrade to the latest release to receive security fixes.
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ If you discover a security vulnerability, please report it by creating a GitHub issue in this repository.
12
+
13
+ Please include the following information:
14
+
15
+ - Description of the vulnerability
16
+ - Steps to reproduce the issue
17
+ - Potential impact
18
+ - Any suggested fixes (if you have them)
19
+
20
+ We will review your report and respond as soon as possible.
21
+
22
+ Thank you for helping keep AdmiralCloud and our users safe!
package/eslint.config.js CHANGED
@@ -1,32 +1,34 @@
1
1
  const globals = require('globals')
2
2
 
3
- module.exports = {
4
- ignores: [
5
- 'config/env/**'
6
- ],
7
- languageOptions: {
8
- ecmaVersion: 2022,
9
- sourceType: 'module',
10
- globals: {
11
- ...globals.commonjs,
12
- ...globals.es2015,
13
- ...globals.node,
14
- expect: 'readonly',
15
- describe: 'readonly',
16
- it: 'readonly'
3
+ module.exports = [
4
+ {
5
+ files: ['index.js', 'test/**.js'],
6
+ languageOptions: {
7
+ ecmaVersion: 2022,
8
+ sourceType: 'module',
9
+ globals: {
10
+ ...globals.commonjs,
11
+ ...globals.es2015,
12
+ ...globals.node,
13
+ expect: 'readonly',
14
+ describe: 'readonly',
15
+ it: 'readonly'
16
+ }
17
+ },
18
+ rules: {
19
+ 'no-const-assign': 'error',
20
+ 'space-before-function-paren': 'off',
21
+ 'no-extra-semi': 'off',
22
+ 'object-curly-spacing': ['error', 'always'],
23
+ 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
24
+ 'block-spacing': 'error',
25
+ 'no-useless-escape': 'off',
26
+ 'no-console': ['warn', { allow: ['warn', 'error'] }],
27
+ 'no-unused-vars': 'error',
28
+ 'eqeqeq': 'error',
29
+ 'no-var': 'error',
30
+ 'curly': 'error',
31
+ 'prefer-const': ['error', { ignoreReadBeforeAssign: true }]
17
32
  }
18
- },
19
- rules: {
20
- 'no-const-assign': 'error', // Ensure this rule is enabled
21
- 'space-before-function-paren': 'off',
22
- 'no-extra-semi': 'off',
23
- 'object-curly-spacing': ['error', 'always'],
24
- 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
25
- 'no-useless-escape': 'off',
26
- 'standard/no-callback-literal': 'off',
27
- 'new-cap': 'off',
28
- 'no-console': ['warn', { allow: ['warn', 'error'] }],
29
- "no-unused-vars": "error", // we shouldn't clutter code with unused variables
30
- "prefer-const": ["warn", { "ignoreReadBeforeAssign": true }],
31
33
  }
32
- }
34
+ ]
package/index.js CHANGED
@@ -28,7 +28,7 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
28
28
  // display accessKey, link (if applicable)
29
29
  const message = data?.message ? ` ${data.message}` : ''
30
30
  let cuid = data?.customerId ? data?.customerId : ''
31
- if (data?.userId) cuid += `/${data.userId} `
31
+ if (data?.userId) { cuid += `/${data.userId} ` }
32
32
  // colorize status codes
33
33
 
34
34
  const statusCode = data?.statusCode
@@ -56,9 +56,9 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
56
56
 
57
57
  // modern approach (fileName, functionName, sub) // TBD with team
58
58
  const functionIdentifier = _.get(data, 'functionIdentifier') ? _.get(data, 'functionIdentifier') + ' | ' : ''
59
- if (!fileName && _.get(data, 'fileName')) fileName = _.get(data, 'fileName')
60
- if (!functionName && _.get(data, 'functionName')) functionName = _.get(data, 'functionName')
61
- if (!subName && _.get(data, 'sub')) subName = _.get(data, 'sub')
59
+ if (!fileName && _.get(data, 'fileName')) { fileName = _.get(data, 'fileName') }
60
+ if (!functionName && _.get(data, 'functionName')) { functionName = _.get(data, 'functionName') }
61
+ if (!subName && _.get(data, 'sub')) { subName = _.get(data, 'sub') }
62
62
 
63
63
 
64
64
  let message = data?.message
@@ -76,7 +76,7 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
76
76
  if (data?.e instanceof Error) {
77
77
  // log the stack
78
78
  console.error(data?.e)
79
- if (data?.e?.message) message += ' | ' + ( data?.e?.message || '')
79
+ if (data?.e?.message) { message += ' | ' + ( data?.e?.message || '') }
80
80
  }
81
81
  // TODO: for better readability, we shold use padding for fileName, functionname, etc
82
82
  return `${data?.timestamp} ${data?.level} ${fileName}${functionName}${functionIdentifier}${subName}${prefixData}${message}`
@@ -149,7 +149,7 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
149
149
  else {
150
150
  _.forEach(transporters, item => {
151
151
  const logTransport = new transports[item.type](item.options)
152
- if (_.has(item, 'onRotate')) logTransport.on('rotate', item.onRotate)
152
+ if (_.has(item, 'onRotate')) { logTransport.on('rotate', item.onRotate) }
153
153
  logTransports.push(logTransport)
154
154
  })
155
155
  }
@@ -158,10 +158,10 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
158
158
  level,
159
159
  transports: logTransports
160
160
  }
161
- if (_.get(customLevels, 'levels')) _.set(logConfig, 'levels', _.get(customLevels, 'levels'))
161
+ if (_.get(customLevels, 'levels')) { _.set(logConfig, 'levels', _.get(customLevels, 'levels')) }
162
162
 
163
163
  const acLogger = createLogger(logConfig)
164
- if (_.get(customLevels, 'colors')) addColors(_.get(customLevels, 'colors'))
164
+ if (_.get(customLevels, 'colors')) { addColors(_.get(customLevels, 'colors')) }
165
165
 
166
166
  const changeLogLevel = (newLevel) => {
167
167
  acLogger.transports.forEach((transport) => {
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": "3.0.4",
6
+ "version": "4.0.0",
7
7
  "dependencies": {
8
- "lodash": "^4.17.23",
8
+ "lodash": "^4.18.1",
9
9
  "moment": "^2.30.1",
10
10
  "winston": "^3.19.0",
11
11
  "winston-daily-rotate-file": "^5.0.0"
12
12
  },
13
13
  "devDependencies": {
14
- "ac-semantic-release": "^0.4.10",
14
+ "ac-semantic-release": "^1.0.1",
15
15
  "chai": "^4.5.0",
16
- "eslint": "^9.39.2",
16
+ "eslint": "^10.2.0",
17
+ "globals": "^17.4.0",
17
18
  "intercept-stdout": "^0.1.2",
18
19
  "mocha": "^11.7.5"
19
20
  },
@@ -21,11 +22,12 @@
21
22
  "test": "mocha --reporter spec"
22
23
  },
23
24
  "engines": {
24
- "node": ">=18.0.0"
25
+ "node": ">=22.0.0"
25
26
  },
26
27
  "resolutions": {
27
28
  "mocha/chokidar/braces": "^3.0.3",
28
- "mocha/diff": "^8.0.2"
29
+ "mocha/diff": "^8.0.3",
30
+ "mocha/serialize-javascript": "^7.0.5"
29
31
  },
30
32
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
31
33
  }
package/test/test.js CHANGED
@@ -1,11 +1,11 @@
1
1
  const { expect } = require('chai')
2
2
  const aclog = require('../index')
3
3
 
4
- var intercept = require("intercept-stdout");
4
+ const intercept = require("intercept-stdout");
5
5
 
6
- var captured_text = "";
6
+ let captured_text = "";
7
7
 
8
- var unhook_intercept = intercept(function(text) {
8
+ const unhook_intercept = intercept(function(text) {
9
9
  captured_text += text;
10
10
  });
11
11