log-queue 2.0.1 → 2.1.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/app.js CHANGED
@@ -26,7 +26,7 @@ exports = module.exports = class LogQueue {
26
26
 
27
27
  t.parent = props.parent
28
28
  t.exclude_logMsg = props.exclude_logMsg
29
- t.appender = "console"
29
+ t.appender = null
30
30
  t.logObj = null
31
31
 
32
32
  t.init = t.init.bind(t)
@@ -48,10 +48,11 @@ exports = module.exports = class LogQueue {
48
48
  a = `./appenders/${t.appender}.js`
49
49
  req = require(a)
50
50
 
51
- t.logObj = new req({
52
- parent: t,
53
- exclude_logMsg: t.exclude_logMsg
54
- })
51
+ props.parent = t
52
+ props.exclude_logMsg = t.exclude_logMsg
53
+ props.colors = colors
54
+
55
+ t.logObj = new req(props)
55
56
 
56
57
  return t
57
58
  } catch (e) {
@@ -7,9 +7,12 @@ exports = module.exports = class log4js_tagline {
7
7
  constructor(props) {
8
8
  var t = this, fname = `log4js_tagline.constructor`
9
9
  try {
10
+ props.colors.disable()
10
11
  t.parent = props.parent
12
+ t.exclude_logMsg = props.exclude_logMsg
13
+ t.logger = props.logger
11
14
  t.logMsg = t.logMsg.bind(t)
12
-
15
+
13
16
  return t
14
17
  } catch (e) {
15
18
  e.message = `${fname} error: ${e.message}`
@@ -18,7 +21,7 @@ exports = module.exports = class log4js_tagline {
18
21
  }
19
22
 
20
23
  logMsg(props = {}) {
21
- let t = this, fname = "log4js_tagline.logMsg"
24
+ let t = this, fname = "log4js_tagline.logMsg", s, ss
22
25
  try {
23
26
  if (typeof props.msg == "undefined")
24
27
  throw new Error(`no msg property in (${JSON.stringify(props)}) `)
@@ -27,7 +30,34 @@ exports = module.exports = class log4js_tagline {
27
30
  if (typeof t.exclude_logMsg != "undefined")
28
31
  if (t.exclude_logMsg.indexOf(props.type) > -1)
29
32
  return
30
- console.log(props.msg)
33
+ s = props.msg
34
+ try {
35
+ // test to see if there's another json object
36
+ ss = JSON.parse(props.msg)
37
+ if (typeof ss.msg != "undefined")
38
+ s = ss.msg
39
+ } catch (e) {
40
+ // do nothing. the failure means it's not a json object
41
+ }
42
+ if (typeof s.msg != 'undefined') {
43
+ s = s.msg
44
+ }
45
+ switch (props.type) {
46
+ case "debug":
47
+ t.logger.debug(JSON.stringify(s)).tagline()
48
+ break
49
+ case "info":
50
+ t.logger.info(JSON.stringify(s)).tagline()
51
+ break
52
+ case "error":
53
+ t.logger.error(JSON.stringify(s)).tagline()
54
+ break
55
+ case "success":
56
+ t.logger.info(JSON.stringify(s)).tagline()
57
+ break
58
+ default:
59
+ t.logger.trace(JSON.stringify(s)).tagline()
60
+ }
31
61
  } catch (e) {
32
62
  e.message = `${fname} error: ${e.message}`
33
63
  console.log(e.message)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": {
3
3
  "name": "Jim Manton"
4
4
  },
5
- "version": "2.0.1",
5
+ "version": "2.1.0",
6
6
  "bundleDependencies": [],
7
7
  "dependencies": {
8
8
  "@types/node": "^18.11.19",
@@ -21,6 +21,8 @@
21
21
  },
22
22
  "keywords": [
23
23
  "log",
24
+ "log4js-tagline",
25
+ "base-queue",
24
26
  "console",
25
27
  "appenders",
26
28
  "javascript",
package/test/package.js CHANGED
@@ -6,7 +6,7 @@ const packageMock = {
6
6
  "author": {
7
7
  "name": "Jim Manton"
8
8
  },
9
- "version": "2.0.1",
9
+ "version": "2.1.0",
10
10
  "bundleDependencies": [],
11
11
  "dependencies": {
12
12
  "@types/node": "^18.11.19",
@@ -25,6 +25,8 @@ const packageMock = {
25
25
  },
26
26
  "keywords": [
27
27
  "log",
28
+ "log4js-tagline",
29
+ "base-queue",
28
30
  "console",
29
31
  "appenders",
30
32
  "javascript",