Skip to content

Commit 5ad8846

Browse files
committed
implements demo
1 parent 378333a commit 5ad8846

7 files changed

Lines changed: 614 additions & 27 deletions

File tree

escriba-browser/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
</head>
66

77
<body>
8-
<script type="module" src="https://unpkg.com/stacktrace-js@2.0.2/dist/stacktrace.min.js"></script>
8+
99
<script type="module">
10-
import { Escriba,HTTPTransport } from './dist/escriba.mjs';
10+
import { Escriba,HTTPTransport } from './dist/escriba.min.mjs';
1111

1212
window.logger = await Escriba.init({
1313
transport: new HTTPTransport("http://localhost:8888/api/logs")

escriba-browser/src/escriba.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StackFrame, fromError } from 'stacktrace-js';
1+
import { StackFrame, fromError } from 'stacktrace-js';
22
/**
33
* Escriba config logging
44
*/
@@ -257,8 +257,9 @@ export class Logger {
257257

258258
private report(log: LogMessage, error?: Error, ...extra: any) {
259259
let line = `[${log.datetime}] - ${log.level} - ${JSON.stringify(log.mdc)} - ${log.message}`;
260-
let lineError = `[${log.datetime}] - ${log.level} - ${JSON.stringify(log.mdc)}`;
261-
if (log.level == LogLevel.ERROR) consoleFn[log.level.toLocaleLowerCase()](lineError, error, ...extra);
260+
let lineError = `[${log.datetime}] - ${log.level} - ${JSON.stringify(log.mdc)} - ${log.message}`;
261+
262+
if (log.level == LogLevel.ERROR) consoleFn[log.level.toLocaleLowerCase()](lineError, error);
262263
else if (extra !== undefined) consoleFn[log.level.toLocaleLowerCase()](line, ...extra);
263264
else consoleFn[log.level.toLocaleLowerCase()](line);
264265
}

0 commit comments

Comments
 (0)