jet-logger 1.2.0 → 1.2.1

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/README.md CHANGED
@@ -22,7 +22,7 @@ take priority over environment variables. Note that file writes happen asynchron
22
22
  - The four environment variables are:
23
23
  - `JET_LOGGER_MODE`: can be `'CONSOLE'`(default), `'FILE'`, `'CUSTOM'`, and `'OFF'`.
24
24
  - `JET_LOGGER_FILEPATH`: the file-path for file mode. Default is `_home_dir/jet-logger.log_`.
25
- - `JET_LOGGER_FILEPATH_DATETIME`: prepend the log file name with the datetime. an be `'TRUE'` (default) or `'FALSE'`.
25
+ - `JET_LOGGER_FILEPATH_DATETIME`: prepend the log file name with the datetime. Can be `'TRUE'` (default) or `'FALSE'`.
26
26
  - `JET_LOGGER_TIMESTAMP`: adds a timestamp next to each log. Can be `'TRUE'` (default) or `'FALSE'`.
27
27
  - `JET_LOGGER_FORMAT`: formats log as a line or JSON object. Can be `'LINE'` (default) or `'JSON'`.
28
28
 
package/lib/index.js CHANGED
@@ -71,16 +71,16 @@ function getSettings(mode, filepath, filepathDatetime, timestamp, format, custom
71
71
  filepath = defaults.filepath;
72
72
  }
73
73
  }
74
- if (filepathDatetime === undefined) {
75
- if (!!process.env.JET_LOGGER_FILEPATH_DATETIME) {
76
- filepathDatetime = (process.env.JET_LOGGER_FILEPATH_DATETIME.toUpperCase() ===
77
- 'TRUE');
74
+ if (filepathDatetime === undefined || filepathDatetime === null) {
75
+ var envVar = process.env.JET_LOGGER_FILEPATH_DATETIME;
76
+ if (!!envVar) {
77
+ filepathDatetime = (envVar.toUpperCase() === 'TRUE');
78
78
  }
79
79
  else {
80
80
  filepathDatetime = defaults.filepathDatetime;
81
81
  }
82
82
  }
83
- if (timestamp === undefined) {
83
+ if (timestamp === undefined || timestamp === null) {
84
84
  if (!!process.env.JET_LOGGER_TIMESTAMP) {
85
85
  timestamp = (process.env.JET_LOGGER_TIMESTAMP.toUpperCase() === 'TRUE');
86
86
  }
@@ -178,8 +178,7 @@ function addDatetimeToFileName(filePath) {
178
178
  .split('-').join('')
179
179
  .split(':').join('')
180
180
  .slice(0, 15);
181
- var filePathArr = filePath.split('/'), lastIdx = filePathArr.length - 1, fileName = filePathArr[lastIdx];
182
- var fileNameNew = (dateStr + '_' + fileName);
181
+ var filePathArr = filePath.split('/'), lastIdx = filePathArr.length - 1, fileName = filePathArr[lastIdx], fileNameNew = (dateStr + '_' + fileName);
183
182
  filePathArr[lastIdx] = fileNameNew;
184
183
  return filePathArr.join('/');
185
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jet-logger",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A super quick, easy to setup logging tool for NodeJS/TypeScript.",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",