Comparing version 2.3.0 to 2.3.1
"use strict"; | ||
for (let i = 0; i < 1 * 1000 * 1000; i++) { | ||
for (var i = 0; i < 1 * 1000 * 1000; i++) { | ||
// eslint-disable-next-line no-console | ||
@@ -5,0 +5,0 @@ console.log(String(i)); |
@@ -10,3 +10,3 @@ "use strict"; | ||
global.ROARR = (0, _createRoarrInititialGlobalState.default)({}); | ||
const Writer = (0, _createWriter.default)({ | ||
var Writer = (0, _createWriter.default)({ | ||
bufferSize: 1024 * 8, | ||
@@ -16,5 +16,5 @@ stream: 'STDOUT' | ||
for (let i = 0; i < 1 * 1000 * 1000; i++) { | ||
for (var i = 0; i < 1 * 1000 * 1000; i++) { | ||
Writer.write(String(i)); | ||
} | ||
//# sourceMappingURL=roarr.js.map |
"use strict"; | ||
for (let i = 0; i < 1 * 1000 * 1000; i++) { | ||
for (var i = 0; i < 1 * 1000 * 1000; i++) { | ||
process.stdout.write(String(i)); | ||
} | ||
//# sourceMappingURL=write.js.map |
@@ -18,9 +18,9 @@ "use strict"; | ||
const command = 'augment'; | ||
var command = 'augment'; | ||
exports.command = command; | ||
const desc = 'Augments Roarr logs with additional information.'; | ||
var desc = 'Augments Roarr logs with additional information.'; | ||
exports.desc = desc; | ||
const createLogFormatter = configuration => { | ||
let instanceId; | ||
var createLogFormatter = function createLogFormatter(configuration) { | ||
var instanceId; | ||
@@ -31,3 +31,3 @@ if (configuration.appendInstanceId) { | ||
const stream = (0, _split.default)(line => { | ||
var stream = (0, _split.default)(function (line) { | ||
if (!(0, _utilities.isRoarrLine)(line)) { | ||
@@ -37,3 +37,3 @@ return configuration.excludeOrphans ? '' : line + '\n'; | ||
const message = JSON.parse(line); | ||
var message = JSON.parse(line); | ||
@@ -54,3 +54,3 @@ if (configuration.appendHostname) { | ||
const builder = yargs => { | ||
var builder = function builder(yargs) { | ||
return yargs.options({ | ||
@@ -76,3 +76,3 @@ 'append-hostname': { | ||
const handler = argv => { | ||
var handler = function handler(argv) { | ||
process.stdin.pipe(createLogFormatter(argv)).pipe(process.stdout); | ||
@@ -79,0 +79,0 @@ }; |
@@ -18,9 +18,11 @@ "use strict"; | ||
const command = 'pretty-print'; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
var command = 'pretty-print'; | ||
exports.command = command; | ||
const desc = 'Format logs for user-inspection.'; | ||
var desc = 'Format logs for user-inspection.'; | ||
/* eslint-disable quote-props */ | ||
exports.desc = desc; | ||
const logLevels = { | ||
var logLevels = { | ||
'10': 'TRACE', | ||
@@ -35,3 +37,3 @@ '20': 'DEBUG', | ||
const logLevelColorMap = { | ||
var logLevelColorMap = { | ||
DEBUG: _chalk.default.gray, | ||
@@ -45,8 +47,8 @@ ERROR: _chalk.default.red, | ||
const getLogLevelName = logLevel => { | ||
var getLogLevelName = function getLogLevelName(logLevel) { | ||
return logLevels[logLevel] || 'INFO'; | ||
}; | ||
const createLogFormatter = configuration => { | ||
const stream = (0, _split.default)(line => { | ||
var createLogFormatter = function createLogFormatter(configuration) { | ||
var stream = (0, _split.default)(function (line) { | ||
if (!(0, _utilities.isRoarrLine)(line)) { | ||
@@ -56,9 +58,9 @@ return configuration.excludeOrphans ? '' : line + '\n'; | ||
const message = JSON.parse(line); | ||
let formattedMessage = ''; | ||
var message = JSON.parse(line); | ||
var formattedMessage = ''; | ||
formattedMessage = '[' + new Date(message.time).toISOString() + ']'; | ||
if (message.context.logLevel && typeof message.context.logLevel === 'number') { | ||
const logLevelName = getLogLevelName(message.context.logLevel); | ||
const logLevelColorName = logLevelColorMap[logLevelName]; | ||
var logLevelName = getLogLevelName(message.context.logLevel); | ||
var logLevelColorName = logLevelColorMap[logLevelName]; | ||
@@ -84,14 +86,14 @@ if (!logLevelColorName) { | ||
/* eslint-disable no-unused-vars */ | ||
const { | ||
application: tmp0, | ||
hostname: tmp1, | ||
instanceId: tmp2, | ||
logLevel: tmp3, | ||
namespace: tmp4, | ||
package: tmp5, | ||
package: tmp6, | ||
...rest | ||
} = message.context; | ||
var _message$context = message.context, | ||
tmp0 = _message$context.application, | ||
tmp1 = _message$context.hostname, | ||
tmp2 = _message$context.instanceId, | ||
tmp3 = _message$context.logLevel, | ||
tmp4 = _message$context.namespace, | ||
tmp5 = _message$context.package, | ||
tmp6 = _message$context.package, | ||
rest = _objectWithoutProperties(_message$context, ["application", "hostname", "instanceId", "logLevel", "namespace", "package", "package"]); | ||
/* eslint-enable */ | ||
if (Object.keys(rest).length) { | ||
@@ -109,3 +111,3 @@ // eslint-disable-next-line no-console | ||
const builder = yargs => { | ||
var builder = function builder(yargs) { | ||
return yargs.options({ | ||
@@ -126,3 +128,3 @@ 'exclude-orphans': { | ||
const handler = argv => { | ||
var handler = function handler(argv) { | ||
process.stdin.pipe(createLogFormatter(argv)).pipe(process.stdout); | ||
@@ -129,0 +131,0 @@ }; |
@@ -8,3 +8,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _isRoarrLine.default; | ||
@@ -11,0 +11,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _default = text => { | ||
var _default = function _default(text) { | ||
return text.includes('"message"') && text.includes('"sequence"'); | ||
@@ -11,0 +11,0 @@ }; |
@@ -13,7 +13,7 @@ "use strict"; | ||
/* eslint-disable no-process-env */ | ||
const ROARR_BUFFER_SIZE = process.env.ROARR_BUFFER_SIZE === undefined ? 0 : parseInt(process.env.ROARR_BUFFER_SIZE, 10); | ||
var ROARR_BUFFER_SIZE = process.env.ROARR_BUFFER_SIZE === undefined ? 0 : parseInt(process.env.ROARR_BUFFER_SIZE, 10); | ||
exports.ROARR_BUFFER_SIZE = ROARR_BUFFER_SIZE; | ||
const ROARR_LOG = (0, _boolean.default)(process.env.ROARR_LOG) === true; | ||
var ROARR_LOG = (0, _boolean.default)(process.env.ROARR_LOG) === true; | ||
exports.ROARR_LOG = ROARR_LOG; | ||
const ROARR_STREAM = (process.env.ROARR_STREAM || 'STDOUT').toUpperCase(); | ||
var ROARR_STREAM = (process.env.ROARR_STREAM || 'STDOUT').toUpperCase(); | ||
exports.ROARR_STREAM = ROARR_STREAM; | ||
@@ -20,0 +20,0 @@ |
@@ -10,4 +10,8 @@ "use strict"; | ||
const version = '1.0.0'; | ||
const logLevels = { | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var version = '1.0.0'; | ||
var logLevels = { | ||
debug: 20, | ||
@@ -21,13 +25,14 @@ error: 50, | ||
const createLogger = (onMessage, parentContext = {}) => { | ||
var createLogger = function createLogger(onMessage) { | ||
var parentContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
// eslint-disable-next-line id-length | ||
const log = (a, b, c, d, e, f, g, h, i, k) => { | ||
const time = Date.now(); | ||
const sequence = global.ROARR.sequence++; | ||
let context; | ||
let message; | ||
var log = function log(a, b, c, d, e, f, g, h, i, k) { | ||
var time = Date.now(); | ||
var sequence = global.ROARR.sequence++; | ||
var context; | ||
var message; | ||
if (typeof a === 'string') { | ||
context = { ...parentContext | ||
}; | ||
context = _objectSpread({}, parentContext); | ||
message = (0, _sprintfJs.sprintf)(a, b, c, d, e, f, g, h, i, k); | ||
@@ -39,5 +44,3 @@ } else { | ||
context = { ...parentContext, | ||
...a | ||
}; | ||
context = _objectSpread({}, parentContext, a); | ||
message = (0, _sprintfJs.sprintf)(b, c, d, e, f, g, h, i, k); | ||
@@ -55,13 +58,13 @@ } | ||
log.child = context => { | ||
return createLogger(onMessage, { ...parentContext, | ||
...context | ||
}); | ||
log.child = function (context) { | ||
return createLogger(onMessage, _objectSpread({}, parentContext, context)); | ||
}; | ||
const logLevelNames = Object.keys(logLevels); | ||
var logLevelNames = Object.keys(logLevels); | ||
for (const logLevelName of logLevelNames) { | ||
var _loop = function _loop() { | ||
var logLevelName = logLevelNames[_i]; | ||
// eslint-disable-next-line id-length | ||
log[logLevelName] = (a, b, c, d, e, f, g, h, i, k) => { | ||
log[logLevelName] = function (a, b, c, d, e, f, g, h, i, k) { | ||
return log.child({ | ||
@@ -71,2 +74,6 @@ logLevel: logLevels[logLevelName] | ||
}; | ||
}; | ||
for (var _i = 0; _i < logLevelNames.length; _i++) { | ||
_loop(); | ||
} | ||
@@ -73,0 +80,0 @@ |
@@ -18,7 +18,11 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
var _default = currentState => { | ||
const versions = (currentState.versions || []).concat(); | ||
var _default = function _default(currentState) { | ||
var versions = (currentState.versions || []).concat(); | ||
versions.sort(_semverCompare.default); | ||
const currentIsLatestVersion = !versions.length || (0, _semverCompare.default)(_package.version, versions[versions.length - 1]) === 1; | ||
var currentIsLatestVersion = !versions.length || (0, _semverCompare.default)(_package.version, versions[versions.length - 1]) === 1; | ||
@@ -30,12 +34,13 @@ if (!versions.includes(_package.version)) { | ||
versions.sort(_semverCompare.default); | ||
const newState = { | ||
var newState = _objectSpread({ | ||
buffer: '', | ||
prepend: {}, | ||
sequence: 0, | ||
...currentState, | ||
sequence: 0 | ||
}, currentState, { | ||
versions | ||
}; | ||
}); | ||
if (currentIsLatestVersion || !newState.write) { | ||
const Writer = (0, _createWriter.default)({ | ||
var Writer = (0, _createWriter.default)({ | ||
bufferSize: _config.ROARR_BUFFER_SIZE, | ||
@@ -42,0 +47,0 @@ stream: _config.ROARR_STREAM |
@@ -9,9 +9,9 @@ "use strict"; | ||
// @todo Add browser support. | ||
var _default = configuration => { | ||
const stream = configuration.stream.toUpperCase() === 'STDOUT' ? process.stdout : process.stderr; | ||
var _default = function _default(configuration) { | ||
var stream = configuration.stream.toUpperCase() === 'STDOUT' ? process.stdout : process.stderr; | ||
if (!configuration.bufferSize) { | ||
return { | ||
flush: () => {}, | ||
write: message => { | ||
flush: function flush() {}, | ||
write: function write(message) { | ||
stream.write(message + '\n'); | ||
@@ -22,3 +22,3 @@ } | ||
const flush = () => { | ||
var flush = function flush() { | ||
if (!global.ROARR.buffer) { | ||
@@ -28,3 +28,3 @@ return; | ||
const buffer = global.ROARR.buffer; | ||
var buffer = global.ROARR.buffer; | ||
global.ROARR.buffer = ''; | ||
@@ -36,3 +36,3 @@ stream.write(buffer); | ||
flush, | ||
write: message => { | ||
write: function write(message) { | ||
global.ROARR.buffer += message + '\n'; | ||
@@ -39,0 +39,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _createLogger.default; | ||
@@ -15,3 +15,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _createRoarrInititialGlobalState.default; | ||
@@ -18,0 +18,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
global.ROARR.registeredFlush = true; | ||
process.on('exit', () => { | ||
process.on('exit', function () { | ||
if (global.ROARR.flush) { | ||
@@ -25,3 +25,3 @@ global.ROARR.flush(); | ||
var _default = (0, _factories.createLogger)(message => { | ||
var _default = (0, _factories.createLogger)(function (message) { | ||
if (!_config.ROARR_LOG) { | ||
@@ -31,3 +31,3 @@ return; | ||
const body = JSON.stringify(message); | ||
var body = JSON.stringify(message); | ||
global.ROARR.write(body); | ||
@@ -34,0 +34,0 @@ }); |
@@ -73,2 +73,3 @@ { | ||
"build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist", | ||
"dev": "NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --watch", | ||
"generate-types": "babel-node ./src/bin/generate-types.js", | ||
@@ -78,3 +79,3 @@ "lint": "eslint ./src ./test && flow", | ||
}, | ||
"version": "2.3.0" | ||
"version": "2.3.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
71941
49
0
407