@spinajs/log 2.0.45 → 2.0.46

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/lib/bootstrap.js CHANGED
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LogBotstrapper = void 0;
13
+ const configuration_1 = require("@spinajs/configuration");
13
14
  const di_1 = require("@spinajs/di");
14
15
  const log_1 = require("./log");
15
16
  const log_configuration_1 = __importDefault(require("./schemas/log.configuration"));
@@ -21,12 +22,28 @@ let LogBotstrapper = class LogBotstrapper extends di_1.Bootstrapper {
21
22
  // mocha errors in console
22
23
  if (!process.env.TESTING) {
23
24
  process.on("uncaughtException", (err) => {
24
- const log = di_1.DI.resolve(log_1.Log, ["process"]);
25
- log.fatal(err, "Unhandled exception occured");
25
+ // if we have configuration resolved, we can assume that logger can read configuration
26
+ // so log to default log
27
+ // if not log to console
28
+ if (di_1.DI.has(configuration_1.Configuration)) {
29
+ const log = di_1.DI.resolve(log_1.Log, ["process"]);
30
+ log.fatal(err, "Unhandled exception occured");
31
+ }
32
+ else {
33
+ console.error("Unhandled exception occured, reason:" + JSON.stringify(err));
34
+ }
26
35
  });
27
36
  process.on("unhandledRejection", (reason, p) => {
28
- const log = di_1.DI.resolve(log_1.Log, ["process"]);
29
- log.fatal(reason, "Unhandled rejection at Promise %s", p);
37
+ // if we have configuration resolved, we can assume that logger can read configuration
38
+ // so log to default log
39
+ // if not log to console
40
+ if (di_1.DI.has(configuration_1.Configuration)) {
41
+ const log = di_1.DI.resolve(log_1.Log, ["process"]);
42
+ log.fatal(reason, "Unhandled rejection at Promise %s", p);
43
+ }
44
+ else {
45
+ console.error("Unhandled rejection at Promise %s, reason: " + JSON.stringify(reason));
46
+ }
30
47
  });
31
48
  }
32
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/b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1
- {
2
- "name": "@spinajs/log",
3
- "version": "2.0.45",
4
- "description": "Log lib for all spinejs related libs",
5
- "main": "lib/index.js",
6
- "private": false,
7
- "scripts": {
8
- "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
9
- "coverage": "nyc npm run test",
10
- "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
11
- "build": "npm run clean && npm run compile",
12
- "compile": "tsc -p tsconfig.build.json",
13
- "clean": "",
14
- "prepare": "npm run build",
15
- "format": "prettier --write \"src/**/*.ts\"",
16
- "lint": "eslint -c .eslintrc.js --ext .ts src",
17
- "prepublishOnly": "npm test && npm run lint",
18
- "preversion": "npm run lint",
19
- "version": "git add -A src",
20
- "postversion": "git push && git push --tags"
21
- },
22
- "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/log)",
23
- "license": "MIT",
24
- "bugs": {
25
- "url": "https://github.com/spinajs/log/issues"
26
- },
27
- "homepage": "https://github.com/spinajs/log#readme",
28
- "dependencies": {
29
- "@colors/colors": "^1.5.0",
30
- "@spinajs/configuration": "^2.0.45",
31
- "@spinajs/di": "^2.0.45",
32
- "@spinajs/exceptions": "^2.0.39",
33
- "@spinajs/log-common": "^2.0.45",
34
- "ajv": "^8.11.0",
35
- "chalk": "4.1.2",
36
- "glob": "^7.2.0",
37
- "glob-to-regexp": "^0.4.1",
38
- "lodash": "^4.17.14",
39
- "luxon": "^3.2.1",
40
- "node-schedule": "^2.1.0"
41
- },
42
- "devDependencies": {
43
- "@types/glob": "7.2.0",
44
- "@types/glob-to-regexp": "^0.4.1",
45
- "@types/mock-fs": "^4.13.1",
46
- "@types/node-schedule": "^1.3.2",
47
- "mock-fs": "^5.1.2"
48
- },
49
- "gitHead": "3aa423c570eae952dc79fe6a4704c3d2ccc178be"
50
- }
1
+ {
2
+ "name": "@spinajs/log",
3
+ "version": "2.0.46",
4
+ "description": "Log lib for all spinejs related libs",
5
+ "main": "lib/index.js",
6
+ "private": false,
7
+ "scripts": {
8
+ "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
9
+ "coverage": "nyc npm run test",
10
+ "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
11
+ "build": "npm run clean && npm run compile",
12
+ "compile": "tsc -p tsconfig.build.json",
13
+ "clean": "",
14
+ "prepare": "npm run build",
15
+ "format": "prettier --write \"src/**/*.ts\"",
16
+ "lint": "eslint -c .eslintrc.js --ext .ts src",
17
+ "prepublishOnly": "npm test && npm run lint",
18
+ "preversion": "npm run lint",
19
+ "version": "git add -A src",
20
+ "postversion": "git push && git push --tags"
21
+ },
22
+ "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/log)",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/spinajs/log/issues"
26
+ },
27
+ "homepage": "https://github.com/spinajs/log#readme",
28
+ "dependencies": {
29
+ "@colors/colors": "^1.5.0",
30
+ "@spinajs/configuration": "^2.0.45",
31
+ "@spinajs/di": "^2.0.45",
32
+ "@spinajs/exceptions": "^2.0.39",
33
+ "@spinajs/log-common": "^2.0.45",
34
+ "ajv": "^8.11.0",
35
+ "chalk": "4.1.2",
36
+ "glob": "^7.2.0",
37
+ "glob-to-regexp": "^0.4.1",
38
+ "lodash": "^4.17.14",
39
+ "luxon": "^3.2.1",
40
+ "node-schedule": "^2.1.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/glob": "7.2.0",
44
+ "@types/glob-to-regexp": "^0.4.1",
45
+ "@types/mock-fs": "^4.13.1",
46
+ "@types/node-schedule": "^1.3.2",
47
+ "mock-fs": "^5.1.2"
48
+ },
49
+ "gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
50
+ }