Releases: maraisr/diary
v0.4.0
BREAKING CHANGE
- Loggers now support arbitrary log messages, see 78334b3
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 a4d95bc
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: v0.3.1...v0.4.0
v0.3.1
v0.3.0
Features
- Workers api no longer appends a pretty symbol for the log level. (724fe38)
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. (61486c8)
Chores
- A series of CI and repo health changes, bumped dev dependencies and updated benchmarks.
Full Changelog: 0.2.2...0.3.0
v0.2.2
v0.2.0
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.
v0.1.6
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');
v0.1.5
v0.1.4
v0.1.2
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.
- this is a simple fix if you still need this, use the new
- Removed
before
/after
. As it turns out, with the newonEmit
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 thediary
constructor. Allows you to output the log entries to other places, thanconsole.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