Logging handlers can now be adapted to special needs

This commit is contained in:
2019-07-02 09:38:19 +02:00
parent 9042579518
commit 1480ad8145
4 changed files with 228 additions and 81 deletions
+13 -2
View File
@@ -8,15 +8,26 @@
<link rel="stylesheet" href="../css/doctest.css">
<script src="./3rdparty/highlight/highlight.pack.js"></script>
<script src="../dist/iwmlib.3rdparty.js"></script>
<script src="../dist/iwmlib.js"></script>
<script src="../dist/iwmlib.js"></script>
</head>
<body id="page" onload="Doctest.run()">
<h1>
Logging
</h1>
<p>Store informations of your app permanently.</p>
<p>Store informations of your app permanently or use app specific logging functions.</p>
<script class="doctest">
Logging.log('app started')
Logging.warn("shouldn't happen")
Logging.error('restart')
Logging.setup({ log: message => console.log("app specific" + message) })
Logging.log("now app related")
</script>
<p>You can overwrite the log, warn, and error handler by using Logging.setup with
app specific functions.</p>
<script class="doctest">
Logging.setup({ log: message => console.log("app specific" + message) })
Logging.log("now app related")
</script>
</body>