diff --git a/README.md b/README.md index 36126f9..8998705 100644 --- a/README.md +++ b/README.md @@ -46,16 +46,16 @@ log.error("error message to be logged"); #### Available log levels -Mirror of syslog (in severity order): +Mirror of applicable syslog levels (in severity order): -- `debug` - debugging information -- `info` - a purely informational message +- `debug` - debugging information (hidden by default) +- `info` - a purely informational message (hidden by default) - `notice` - condition normal, but significant - `warning` (also aliased as `warn`) - condition warning -- `error` - condition error -- `critical` - condition critical -- `alert` - immediate action required -- `emergency` - system unusable +- `error` - condition error - to notify of errors accompanied with recovery mechanism (hence reported as log and not as uncaught exception) + +_Note: `critical`, `alert`, `emergency` are not exposed as seem to not serve a use case in context of JS applications, +such errors should be exposed as typical exceptions_ #### Output message formatting diff --git a/levels.json b/levels.json index 59cdcbe..b690383 100644 --- a/levels.json +++ b/levels.json @@ -1 +1 @@ -["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"] +["debug", "info", "notice", "warning", "error"] diff --git a/lib/level-symbols.json b/lib/level-symbols.json index b610882..366bb54 100644 --- a/lib/level-symbols.json +++ b/lib/level-symbols.json @@ -1,10 +1 @@ -{ - "debug": "●", - "info": "ℹ", - "notice": "ℹ", - "warning": "⚠", - "error": "✖", - "critical": "✖", - "alert": "✖", - "emergency": "✖" -} +{ "debug": "●", "info": "ℹ", "notice": "ℹ", "warning": "⚠", "error": "✖" } diff --git a/test/index/01-index.js b/test/index/01-index.js index 0d69578..b534541 100644 --- a/test/index/01-index.js +++ b/test/index/01-index.js @@ -72,9 +72,6 @@ test("(main)", function (t) { t.equal(typeof log.notice, "function"); t.equal(typeof log.warning, "function"); t.equal(typeof log.error, "function"); - t.equal(typeof log.critical, "function"); - t.equal(typeof log.alert, "function"); - t.equal(typeof log.emergency, "function"); t.end(); }); diff --git a/test/index/04-events.js b/test/index/04-events.js index 8a35659..b3ed9f1 100644 --- a/test/index/04-events.js +++ b/test/index/04-events.js @@ -72,7 +72,7 @@ test("(main): Events", function (t) { t.test("new level logger instance is created", function (t) { var currentLog, caughtEvent; emitter.once("init", function (event) { caughtEvent = event; }); - currentLog = log.critical; + currentLog = log.warn; t.equal(caughtEvent.logger, currentLog, "Event should expose initialized logger"); t.end(); }); diff --git a/test/lib/setup-visibility/02-existing.js b/test/lib/setup-visibility/02-existing.js index 9619cdb..02411f7 100644 --- a/test/lib/setup-visibility/02-existing.js +++ b/test/lib/setup-visibility/02-existing.js @@ -22,7 +22,6 @@ test("lib: setupVisibility: Affects already created loggers", function (t) { log.debug.get("e1:d"); log.warning.get("e2:e"); log.error.get("foo"); - log.alert.get("foo"); log.warning.get("e1"); setupEnv("error", ["e1", "-e1:d", "n1:d", "-n1:d:foo:*"]); @@ -30,7 +29,6 @@ test("lib: setupVisibility: Affects already created loggers", function (t) { t.equal(log.debug.isEnabled, false, "Disables level logger deep below level threshold"); t.equal(log.warning.isEnabled, false, "Disables level logger just below threshold"); t.equal(log.error.isEnabled, true, "Keeps logger at the threshold enabled"); - t.equal(log.alert.isEnabled, true, "Keeps loggers above threshold enabled"); t.test("Applies debug namespace map for level loggers below threshold", function (t) { t.equal(log.warning.get("e1").isEnabled, true, "Enables directly mentioned namespace"); diff --git a/test/lib/setup-visibility/03-future.js b/test/lib/setup-visibility/03-future.js index 45664da..1618ff7 100644 --- a/test/lib/setup-visibility/03-future.js +++ b/test/lib/setup-visibility/03-future.js @@ -22,13 +22,11 @@ test("lib: setupVisibility: Affects loggers created later", function (t) { log.debug.get("e1:d"); log.warning.get("e2:e"); log.error.get("foo"); - log.alert.get("foo"); log.warning.get("e1"); setupEnv("error", ["e1", "-e1:d", "n1:d", "-n1:d:foo:*"]); t.equal(log.info.isEnabled, false, "Disables level logger deep below level threshold"); - t.equal(log.critical.isEnabled, true, "Keeps loggers above threshold enabled"); t.test("Applies debug namespace map for level loggers below threshold", function (t) { t.equal(log.info.get("e1").isEnabled, true, "Enables directly mentioned namespace");