Maraisr Diary Versions Save

đź“‘ Zero-dependency, fast logging library for Node, Browser and Workers

v0.4.0

1 year ago

BREAKING CHANGE

  • Loggers now support arbitrary log messages, see 78334b38ac7a41e33169562c17829933fd2479b9

Log functions no longer require a message string in the first argument, this means reporters that used to tap into extra for the spread arguments you will now find this in the messages array.

- const reporter: Reporter = ({ name, level, message, extra, ...rest })
+ const reporter: Reporter = ({ name, level, messages, ...rest })
..
-   console.log({ message, extra });
+   const message = messages.shift();
+   console.log({ message, extra: messages });
  • Browsers no longer enable by default, see a4d95bccd4db33f2cbca91ef2034113eb319f6c1

In the past we enbaled anyting in the DEBUG localStorage key, this lead to some undesired behaviours when working with sandboxed iframes.

Now we will let the you control this completely, as from what I can see the majority of folk I see, use it anyway.

Still makes sense to run this for Node applications, which is left un touched.

If you want the existing behaviour, just attached this before you start logging.

import { enable } from 'diary';
enable(localStorage.DEBUG || 'a^');

Full Changelog: https://github.com/maraisr/diary/compare/v0.3.1...v0.4.0

v0.3.1

1 year ago

Features

Full Changelog: https://github.com/maraisr/diary/compare/0.3.0...v0.3.1

0.3.0

2 years ago

Features

  • Workers api no longer appends a pretty symbol for the log level. (724fe38dfc7e6fd15440a0965cfe1c9999437af2)

BREAKING CHANGES

  • In order to support Cloudflare Module Workers — ambient environment variables no longer exist. Which leaves this up to the developer to opt log events in with the supplied enable api. (61486c8f0aea97dc37226ffb75204a0cb45f7c66)

Chores

  • A series of CI and repo health changes, bumped dev dependencies and updated benchmarks.

Full Changelog: https://github.com/maraisr/diary/compare/0.2.2...0.3.0

0.2.2

2 years ago

Bug fixes

  • After the last release (v0.2.0) type definition resolution broke in that instead of diary/index as the resolution path its diary/node/index which for obvious reasons doesn't have types. Now we just force the root to diary/index.d.ts — 70475fd348f0a9485d26241257c71460590ec82a

Features

  • Attempt a deno publish

0.2.0

2 years ago

Features

diary now supports being used in a Cloudflare Worker — enabled via an Environment Variable named DEBUG to behave the same as though it was a node or browser runtime.

Build

diary is now built in 3 flavors and relies on bundles to import the correct one.

0.1.6

2 years ago

Features

  • New compare util to help with log level comparing.
import { compare } from 'diary/utils';

// when `a` is _less-than_ `b` then -1
compare('warn', 'error');

// when `a` is _more-than_ `b` then 1
compare('fatal', 'error');

// when `a` is the _same_  as`b` then 0
compare('fatal', 'fatal');

0.1.5

2 years ago

Features

  • The default reporter is now exported as well import { defaultReporter } from 'diary';

0.1.4

2 years ago

Chores

  • Fixed broken typescript definitions resolution (#10) Thanks @maxmilton ~

0.1.2

2 years ago

Breaking

  • Removed the setLevel method—all events will now log irrespective of their level.
    • this is a simple fix if you still need this, use the new onEmit callback to squash these.
  • Removed before/after. As it turns out, with the new onEmit api on diary. One can create the same effect—with much less overhead.

Features

  • Added new enable method to control the allow list programmatically.
  • Added new onEmit argument to the diary constructor. Allows you to output the log entries to other places, than console.log.
  • Following on from that; added a new diary/json sub-module that allows formatting the messages as json!

Chores

  • Upgraded packages
  • Builds using esbuild
  • Updated benchmarks