@megatherium/log
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -26,4 +26,2 @@ "use strict"; | ||
var _winston = _interopRequireDefault(require("winston")); | ||
var _util = require("util"); | ||
@@ -58,29 +56,36 @@ | ||
value: function getLogger() { | ||
if (typeof window !== 'undefined') return { | ||
log: function log() {} | ||
}; | ||
if (!this.logger) { | ||
var service = this.meta.app ? "".concat(this.meta.environment, "/").concat(this.meta.app) : "".concat(this.meta.environment); | ||
this.logger = _winston["default"].createLogger({ | ||
var winston = require('winston'); | ||
this.logger = winston.createLogger({ | ||
level: 'silly', | ||
format: _winston["default"].format.json(), | ||
format: winston.format.json(), | ||
defaultMeta: _objectSpread({ | ||
service: service | ||
}, this.meta), | ||
transports: [new _winston["default"].transports.File({ | ||
transports: [new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'error.log'), | ||
level: 'error' | ||
}), new _winston["default"].transports.File({ | ||
}), new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'warn.log'), | ||
level: 'warn' | ||
}), new _winston["default"].transports.File({ | ||
}), new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'info.log'), | ||
level: 'info' | ||
}), new _winston["default"].transports.File({ | ||
}), new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'http.log'), | ||
level: 'http' | ||
}), new _winston["default"].transports.File({ | ||
}), new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'verbose.log'), | ||
level: 'verbose' | ||
}), new _winston["default"].transports.File({ | ||
}), new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'debug.log'), | ||
level: 'debug' | ||
}), new _winston["default"].transports.File({ | ||
}), new winston.transports.File({ | ||
filename: _path["default"].join(this.meta.logDirectory, 'all.log') | ||
@@ -101,12 +106,20 @@ })] | ||
case 0: | ||
_context.next = 2; | ||
if (!(typeof window !== 'undefined')) { | ||
_context.next = 2; | ||
break; | ||
} | ||
return _context.abrupt("return"); | ||
case 2: | ||
_context.next = 4; | ||
return _regenerator["default"].awrap(readdir(this.meta.logDirectory)); | ||
case 2: | ||
case 4: | ||
filenames = _context.sent; | ||
i = 0; | ||
case 4: | ||
case 6: | ||
if (!(i < filenames.length)) { | ||
_context.next = 16; | ||
_context.next = 18; | ||
break; | ||
@@ -116,25 +129,25 @@ } | ||
filename = _path["default"].join(this.meta.logDirectory, filenames[i]); | ||
_context.next = 8; | ||
_context.next = 10; | ||
return _regenerator["default"].awrap(stat(filename)); | ||
case 8: | ||
case 10: | ||
stats = _context.sent; | ||
if (stats.isFile()) { | ||
_context.next = 11; | ||
_context.next = 13; | ||
break; | ||
} | ||
return _context.abrupt("continue", 13); | ||
return _context.abrupt("continue", 15); | ||
case 11: | ||
_context.next = 13; | ||
case 13: | ||
_context.next = 15; | ||
return _regenerator["default"].awrap(writeFile(filename, '')); | ||
case 13: | ||
case 15: | ||
++i; | ||
_context.next = 4; | ||
_context.next = 6; | ||
break; | ||
case 16: | ||
case 18: | ||
case "end": | ||
@@ -141,0 +154,0 @@ return _context.stop(); |
{ | ||
"name": "@megatherium/log", | ||
"license": "UNLICENSED", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28100
632