@schukai/monster 2.0.7 → 2.0.8

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
@@ -73,7 +73,7 @@ We do try to work around some browser bugs, but on the whole we don't use polyfi
73
73
  However, many functions can be mapped via [polyfill.io](https://polyfill.io/) and thus the compatibility can be increased.
74
74
 
75
75
  ```html
76
- <script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?feat"
76
+ <script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,CustomEvent,DataView,document,Document,DocumentFragment,Element,Event,fetch,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
77
77
  crossorigin="anonymous"
78
78
  referrerpolicy="no-referrer"></script>
79
79
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schukai/monster",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Monster is a simple library for creating fast, robust and lightweight websites.",
5
5
  "keywords": [
6
6
  "framework",
@@ -5,22 +5,22 @@
5
5
  * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
6
6
  */
7
7
 
8
- import {Base} from '../../types/base.mjs';
9
8
  import {getGlobalObject} from "../../types/global.mjs";
10
9
  import {Handler} from '../handler.mjs';
11
10
  import {LogEntry} from "../logentry.mjs";
11
+ import {TRACE, WARN, DEBUG, ERROR, FATAL, INFO} from "../logger.mjs";
12
12
 
13
13
  export {ConsoleHandler}
14
14
 
15
15
  /**
16
16
  * You can create an object of the class simply by using the namespace `new Monster.Logging.Handler.ConsoleHandler()`.
17
- *
17
+ *
18
18
  * @license AGPLv3
19
19
  * @since 1.5.0
20
20
  * @copyright schukai GmbH
21
21
  * @memberOf Monster.Logging.Handler
22
22
  */
23
- class ConsoleHandler extends Handler {
23
+ class ConsoleHandler extends Handler {
24
24
  constructor() {
25
25
  super();
26
26
  }
@@ -38,7 +38,29 @@ export {ConsoleHandler}
38
38
  if (super.log(entry)) {
39
39
  let console = getGlobalObject('console');
40
40
  if (!console) return false;
41
- console.log(entry.toString());
41
+
42
+ if (!console.error) console.error = console.log;
43
+ if (!console.warn) console.warn = console.log;
44
+
45
+ switch (entry.getLogLevel()) {
46
+ case TRACE:
47
+ case DEBUG:
48
+ case INFO:
49
+ console.log(entry.toString());
50
+ break;
51
+ case FATAL:
52
+ case ERROR:
53
+ console.error(entry.toString());
54
+ break;
55
+ case WARN:
56
+ console.warn(entry.toString());
57
+ break;
58
+ default:
59
+ console.log(entry.toString());
60
+ break;
61
+
62
+ }
63
+
42
64
  return true;
43
65
  }
44
66
 
@@ -137,7 +137,7 @@ function getMonsterVersion() {
137
137
  }
138
138
 
139
139
  /** don't touch, replaced by make with package.json version */
140
- monsterVersion = new Version('2.0.7')
140
+ monsterVersion = new Version('2.0.8')
141
141
 
142
142
  return monsterVersion;
143
143
 
@@ -1,7 +1,7 @@
1
1
  import {expect} from "chai";
2
2
  import {ConsoleHandler} from "../../../../../application/source/logging/handler/console.mjs";
3
3
  import {LogEntry} from "../../../../../application/source/logging/logentry.mjs";
4
- import {FATAL} from "../../../../../application/source/logging/logger.mjs";
4
+ import {TRACE, WARN, DEBUG, ERROR, FATAL, INFO} from "../../../../../application/source/logging/logger.mjs";
5
5
 
6
6
  describe('Logging', function () {
7
7
 
@@ -12,7 +12,27 @@ describe('Logging', function () {
12
12
  });
13
13
 
14
14
  it('should log to console', function () {
15
- expect(new ConsoleHandler().setAll().log(new LogEntry(FATAL, [1, true, 'message']))).to.be.true;
15
+ expect(new ConsoleHandler().setAll().log(new LogEntry(FATAL, [1, true, 'fatal']))).to.be.true;
16
+ });
17
+
18
+ it('should log to console', function () {
19
+ expect(new ConsoleHandler().setAll().log(new LogEntry(TRACE, [1, true, 'trace']))).to.be.true;
20
+ });
21
+
22
+ it('should log to console', function () {
23
+ expect(new ConsoleHandler().setAll().log(new LogEntry(WARN, [1, true, 'warn']))).to.be.true;
24
+ });
25
+
26
+ it('should log to console', function () {
27
+ expect(new ConsoleHandler().setAll().log(new LogEntry(DEBUG, [1, true, 'debug']))).to.be.true;
28
+ });
29
+
30
+ it('should log to console', function () {
31
+ expect(new ConsoleHandler().setAll().log(new LogEntry(ERROR, [1, true, 'error']))).to.be.true;
32
+ });
33
+
34
+ it('should log to console', function () {
35
+ expect(new ConsoleHandler().setAll().log(new LogEntry(INFO, [1, true, 'info']))).to.be.true;
16
36
  });
17
37
  });
18
38
 
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version('2.0.7')
10
+ monsterVersion = new Version('2.0.8')
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
@@ -5,7 +5,7 @@
5
5
  <title>Mocha Monster</title>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7
7
  <link rel="stylesheet" href="mocha.css"/>
8
- <script id="polyfill"
8
+ <script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,CustomEvent,DataView,document,Document,DocumentFragment,Element,Event,fetch,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
9
9
  src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,DataView,document,DocumentFragment,Element,Event,globalThis,HTMLDocument,HTMLTemplateElement,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,WeakMap,WeakSet"
10
10
  crossorigin="anonymous"
11
11
  referrerpolicy="no-referrer"></script>
@@ -14,7 +14,7 @@
14
14
  </head>
15
15
  <body>
16
16
  <div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
17
- <h1 style='margin-bottom: 0.1em;'>Monster 0.1.8</h1>
17
+ <h1 style='margin-bottom: 0.1em;'>Monster 2.0.7</h1>
18
18
  <div id="lastupdate" style='font-size:0.7em'>last update So 7. Aug 19:45:23 CEST 2022</div>
19
19
  </div>
20
20
  <div id="mocks"></div>