-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
70 lines (70 loc) · 3.02 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Logger.js 1.2.0 - Demo</title>
<style>
html, body { align-items: center; display: flex; flex-direction: column; font-family: sans-serif; height: 100%; justify-content: center; margin: 0; width: 100%; }
html { width: 100%; }
body { text-align: center; width: 80%; }
hr { color: white; width: 75%; }
</style>
</head>
<body>
<a href="https://github.com/ArthurBeaulieu/Logger.js" target="_blank" style="position: absolute; right: 0; top: 0;"><img width="149" height="149" src="https://github.blog/wp-content/uploads/2008/12/forkme_right_darkblue_121621.png?resize=149%2C149" alt="Fork me on GitHub"></a>
<h1>Logger.js – Version 1.2.0</h1>
<hr>
<h3>Sample errors are generated in the console</h3>
<hr>
<p>
<a href="https://github.com/ArthurBeaulieu/Logger.js/releases" title="Releases" target="_blank" rel="noreferrer noopener"><img src="https://badgen.net/badge/version/1.2.0/blue" alt="version-badge"></a>
<a href="https://github.com/ArthurBeaulieu/Logger.js/blob/master/LICENSE" title="License" target="_blank" rel="noreferrer noopener"><img src="https://img.shields.io/github/license/ArthurBeaulieu/Logger.js.svg" alt="license-badge"></a>
<a href="doc/index.html" title="Documentation" target="_blank" rel="noreferrer noopener"><img src="https://badgen.net/badge/documentation/written/green" alt="documentation-badge"></a>
<img src="https://badgen.net/badge/test/passed/green" alt="test-badge" title="Run npm run test">
<img src="https://badgen.net/badge/dependencies/none/green" alt="dependencies-badge" title="Check package.json file">
</p>
<p style="font-size: .9rem; font-style: italic; margin: 0;">Arthur Beaulieu – October 2020</p>
<script type="module">
import Logger from './src/Logger.js';
// Create logger singleton
let MyLogger = new Logger({
errors: {
"SAMPLE_ERROR_1": {
"title": "Error 1 title",
"message": "Some justification. See log for details.",
"severity": "error"
},
"SAMPLE_ERROR_2": {
"title": "Error 2 title",
"message": "Some justification. See log for details.",
"severity": "warning"
},
"SAMPLE_ERROR_3": {
"title": "Error 3 title",
"message": "Some justification. See log for details.",
"severity": "info"
},
"SAMPLE_ERROR_4": {
"title": "Error 4 title",
"message": "Some justification. See log for details.",
"severity": "success"
}
},
notification: null,
log: true
});
// Sending a bunch of errors
MyLogger.raise('SAMPLE_ERROR_1');
MyLogger.raise('SAMPLE_ERROR_2');
MyLogger.raise('SAMPLE_ERROR_3');
MyLogger.raise('SAMPLE_ERROR_4');
MyLogger.raise(new Error('TypeError'));
// Define a method to see the stack trace in error feedback
const traceTest = () => {
MyLogger.raise(new Error('FokError'));
};
// Call for it
traceTest();
</script>
</body>
</html>