Skip to content

Commit

Permalink
🚧 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
maraisr committed May 22, 2024
1 parent e578d01 commit a41906d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class User {
function example(oe: OnEmitFn) {
let user = new User();

let scope = diary(oe);
let scope = diary(oe, {pid: Deno.pid});

scope('log', 'this is a log message');
scope('info', 'this is an info message');
Expand All @@ -31,6 +31,8 @@ function example(oe: OnEmitFn) {

scope('info', 'this {user} exists', { user });
scope('info', 'we call that user {name} with {id}', user);

scope('info', 'we also have inherited props like {pid}');
}

console.log('============ PRETTY ============\n');
Expand All @@ -48,7 +50,6 @@ example((level, message, props) => {
let event = {
'@t': new Date().toISOString(),
'@l': level,
'@sc': name,
'@m': interpolate(message, props),
'@mt': message,
...props,
Expand Down
4 changes: 2 additions & 2 deletions migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ let v5Events: any[] = [];
}

{
const log = v5.diary('v0.5', (name, level, event, props) => {
const log = v5.diary((level, event, props) => {
v5Events.push({ name, level, messages: [event, props] });
});
}, {name: 'v0.5'});

log('debug', 'hello');
log('log', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
Expand Down

0 comments on commit a41906d

Please sign in to comment.