Skip to content

Commit

Permalink
New: Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Dec 10, 2018
1 parent 70b302f commit a5874ac
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
34 changes: 34 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

var format = require('util').format;

var sparkles = require('sparkles');

var levels = [
'debug',
'info',
'warn',
'error'
];

function getLogger(namespace){
var logger = sparkles(namespace);

levels.forEach(function(level){
logger[level] = makeLogLevel(level);
});

return logger;
}

function makeLogLevel(level){
return function(msg){
if(typeof msg === 'string'){
msg = format.apply(null, arguments);
}

this.emit(level, msg);
};
}

module.exports = getLogger;
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "glogg",
"version": "0.0.0",
"description": "Global logging utility",
"main": "index.js",
"scripts": {
"test": "lab -cv"
},
"repository": {
"type": "git",
"url": "https://github.com/phated/glogg"
},
"keywords": [
"global",
"log",
"logging",
"logger",
"shared"
],
"author": "Blaine Bublitz <blaine@iceddev.com> (http://iceddev.com/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/phated/glogg/issues"
},
"homepage": "https://github.com/phated/glogg",
"dependencies": {
"sparkles": "git://github.com/phated/sparkles"
},
"devDependencies": {
"code": "^1.2.1",
"lab": "^5.1.1"
}
}

0 comments on commit a5874ac

Please # to comment.