1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.convertLogLevel = exports.trace = exports.fatal = exports.warn = exports.debug = exports.error = exports.info = exports.logAdditionalKeys = void 0;
|
7 | const logger_1 = __importDefault(require("@cumulus/logger"));
|
8 | const isNumber_1 = __importDefault(require("lodash/isNumber"));
|
9 | const isString_1 = __importDefault(require("lodash/isString"));
|
10 | function logger() {
|
11 | return new logger_1.default({
|
12 | asyncOperationId: process.env.ASYNCOPERATIONID,
|
13 | executions: process.env.EXECUTIONS,
|
14 | granules: process.env.GRANULES,
|
15 | parentArn: process.env.PARENTARN,
|
16 | sender: process.env.SENDER,
|
17 | stackName: process.env.STACKNAME,
|
18 | version: process.env.TASKVERSION,
|
19 | });
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | function logAdditionalKeys(additionalKeys, ...args) {
|
29 | logger().infoWithAdditionalKeys(additionalKeys, ...args);
|
30 | }
|
31 | exports.logAdditionalKeys = logAdditionalKeys;
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | function info(...args) {
|
38 | logger().info(...args);
|
39 | }
|
40 | exports.info = info;
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function error(...args) {
|
47 | logger().error(...args);
|
48 | }
|
49 | exports.error = error;
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | function debug(...args) {
|
56 | logger().debug(...args);
|
57 | }
|
58 | exports.debug = debug;
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | function warn(...args) {
|
65 | logger().warn(...args);
|
66 | }
|
67 | exports.warn = warn;
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | function fatal(...args) {
|
74 | logger().fatal(...args);
|
75 | }
|
76 | exports.fatal = fatal;
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | function trace(...args) {
|
83 | logger().trace(...args);
|
84 | }
|
85 | exports.trace = trace;
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | function convertLogLevel(level) {
|
94 | warn('@cumulus/common/log.convertLogLevel() is deprecated after version 1.23.2 and will be removed in a future release.');
|
95 | const mapping = {
|
96 | fatal: 60,
|
97 | error: 50,
|
98 | warn: 40,
|
99 | info: 30,
|
100 | debug: 20,
|
101 | trace: 10,
|
102 | };
|
103 |
|
104 | if (isString_1.default(level))
|
105 | return mapping[level];
|
106 |
|
107 | if (isNumber_1.default(level))
|
108 | return Object.keys(mapping).find((key) => mapping[key] === level);
|
109 | return undefined;
|
110 | }
|
111 | exports.convertLogLevel = convertLogLevel;
|
112 |
|
\ | No newline at end of file |