Socket
Socket
Sign inDemoInstall

logmimosa

Package Overview
Dependencies
3
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-rc.8 to 1.0.0

13

lib/config.js

@@ -14,7 +14,7 @@ "use strict";

enabled: true,
color: 'yellow'
color: 'yellow+bold'
},
success: {
enabled: true,
color: 'green+bold'
color: 'green'
},

@@ -28,2 +28,6 @@ error: {

},
embeddedText: {
enabled: true,
color: 'cyan'
},
growl: {

@@ -56,2 +60,5 @@ enabled: true,

" # color: 'blue' # color for debug level logging, null is default terminal color\n" +
" # embeddedText: # config for text surrounded in [[ ]] inside log messages\n" +
" # enabled: true # transforms [[ ]] and the text inside to just text inside and colorizes\n" +
" # color: 'cyan' # color for transformed embedded text\n" +
" # growl: # Settings for growl notifications\n" +

@@ -85,3 +92,3 @@ " # enabled: true # Whether or not growl notificaations are enabled\n" +

['info', 'warn', 'success', 'error', 'debug'].forEach( function( logLevel ) {
['info', 'warn', 'success', 'error', 'debug', 'embeddedText'].forEach( function( logLevel ) {
if ( validators.ifExistsIsObject( errors, "logger." + logLevel, config.logger[logLevel] ) ) {

@@ -88,0 +95,0 @@ validators.ifExistsIsBoolean( errors, "logger." + logLevel + ".enabled", config.logger[logLevel].enabled );

@@ -1,4 +0,6 @@

var blue, buildDone, color, config, debug, doDebug, error, fatal, green, growl, info, isDebug, isStartup, mimosaConfig, red, setConfig, setDebug, success, warn, _log, _wrap,
var blue, buildDone, color, config, debug, doDebug, error, fatal, green, growl, info, isDebug, isStartup, mimosaConfig, pathh, red, setConfig, setDebug, success, warn, _colorize, _log, _wrap,
__slice = [].slice;
pathh = require('path');
color = require('ansi-color').set;

@@ -61,3 +63,4 @@

}
messages = _wrap(messages, colorText);
_wrap(messages, logLevel, colorText);
messages = _colorize(messages);
if (logLevel === 'error' || logLevel === 'warn' || logLevel === 'fatal') {

@@ -70,9 +73,27 @@ return console.error.apply(console, messages);

_wrap = function(messages, textColor) {
messages[0] = ("" + (new Date().toFormat('HH24:MI:SS')) + " - ") + messages[0];
_colorize = function(messages) {
if (!mimosaConfig) {
return messages;
}
return messages.map(function(message) {
return color(message, textColor);
return message.replace(/\[\[ (.+?) ]]/g, function(match, path) {
if (mimosaConfig.logger.embeddedText.enabled) {
path = path.replace(mimosaConfig.root + pathh.sep, '');
return color(path, mimosaConfig.logger.embeddedText.color);
} else {
return match.replace(mimosaConfig.root + pathh.sep, '');
}
});
});
};
_wrap = function(messages, logLevel, textColor) {
var levelUpper;
levelUpper = logLevel === "error" || logLevel === "warn" || logLevel === 'fatal' ? logLevel.toUpperCase() : logLevel.charAt(0).toUpperCase() + logLevel.slice(1);
if (textColor) {
levelUpper = color(levelUpper, textColor);
}
return messages[0] = ("" + (new Date().toFormat('HH24:MI:SS')) + " - ") + levelUpper + " - " + messages[0];
};
error = function() {

@@ -111,4 +132,4 @@ var colorText, exitIfBuild, lastField, parms;

if (!mimosaConfig || mimosaConfig.logger.info.enabled) {
if (mimosaConfig && mimosaConfig.logger.info.color) {
return _log('info', parms, mimosaConfig.logger.info.color);
if (mimosaConfig) {
return _log('info', parms, mimosaConfig.logger.info.color || '');
} else {

@@ -115,0 +136,0 @@ parms[0] = ("" + (new Date().toFormat('HH24:MI:SS')) + " - ") + parms[0];

{
"name": "logmimosa",
"version": "1.0.0-rc.8",
"version": "1.0.0",
"homepage": "http://www.mimosa.io",

@@ -20,7 +20,9 @@ "author": "David Bashford",

"module",
"mmodule"
"mmodule",
"logging",
"growl"
],
"dependencies": {
"growl": "1.7.0",
"date-utils": "1.2.12",
"date-utils": "1.2.15",
"ansi-color": "0.2.1"

@@ -27,0 +29,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc