Skip to content

Commit

Permalink
2.0.0-beta.2: API improvements
Browse files Browse the repository at this point in the history
* Loggers are functions now. Supports debug-style API
* Logger function defaults to level DEBUG
* Logger function accepts a level name as first parameter
* Added aliases 'verbose' and 'silly' for levels 'log' and 'trace', respectively
* Ulog now supports hooks for logger extension and formatters
* Ulog should now be a drop-in replacement for [debug](https://npmjs.com/package/debug)

New in beta.2: In node version, file descriptor is exposed on console.fd so it can
be used in extensions.

## Backward compatible
v2 Should be a backward-compatible release. But possibly some (very) old browsers are no longer supported
because of the use of Function.prototype.name. Tested on Internet Explorer 11, Edge 41, Opera 49, Chrome 63.
Please test before upgrading and report any issues in the [issue tracker](https://github.com/download/ulog/issues).
Not tested in Safari because I do not have access to a Mac. Help in testing welcome!
  • Loading branch information
Download committed Dec 27, 2017
1 parent 355d8a9 commit 17c92ed
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if (typeof fd == 'number') {
logger = function(){stream.write(util.format.apply(this, arguments) + '\n')}
c = {error:logger, warn:logger, info:logger, log:logger, trace:logger}
}
if (fd !== undefined) c.fd = fd

log.extends.push(function(o,p){
// makes Node behave like browsers
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.0.0-beta.1",
"description": "Microscopically small universal logging library",
"main": "node.js",
"unpkg": "ulog.min.js",
"browser": "browser.js",
"scripts": {
"clean": "rimraf ulog.umd.js && rimraf ulog.min.js",
Expand Down
2 changes: 1 addition & 1 deletion ulog.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function create(n,r) {
function extend(o,p,l) {
if (o.log) return
o.NONE = 0
o.ulog = {version:'2.0.0-beta.1'}
o.ulog = {version:'2.0.0-beta.2'}
for (var key in LVL) {o[key] = LVL[key]}
Object.defineProperty(o, 'level', {
get: function(){return l !== undefined ? l : p && p.level},
Expand Down
2 changes: 1 addition & 1 deletion ulog.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ulog.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function create(n,r) {
function extend(o,p,l) {
if (o.log) return
o.NONE = 0
o.ulog = {version:'2.0.0-beta.1'}
o.ulog = {version:'2.0.0-beta.2'}
for (var key in LVL) {o[key] = LVL[key]}
Object.defineProperty(o, 'level', {
get: function(){return l !== undefined ? l : p && p.level},
Expand Down

0 comments on commit 17c92ed

Please sign in to comment.