Skip to content

Commit

Permalink
get rid of the lodash dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalzinger committed Dec 5, 2014
1 parent af3b4db commit b6c25dc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "cat-log4angular",
"version": "14.12.1",
"dependencies": {
"angular": "1.2.26",
"lodash": "2.4.1"
"angular": "1.2.26"
},
"devDependencies": {
"angular-mocks": "1.2.26",
Expand Down
3 changes: 1 addition & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ var bowerJsonTemplate = [
' ],',
' "license": "The MIT License (MIT)",',
' "dependencies": {',
' "angular": "<%= dependencies.angular %>",',
' "lodash": "<%= dependencies.lodash %>"',
' "angular": "<%= dependencies.angular %>"',
' },',
' "main": [',
' "cat-log4angular.min.js"',
Expand Down
7 changes: 5 additions & 2 deletions src/main/javascript/cat-http-appender.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ angular
},
flush: function () {
var minLevelOrder = LOG_LEVEL_ORDER[minLevel];
var logsToSend = _.filter(_.clone(logs), function (logEntry) {
return LOG_LEVEL_ORDER[logEntry.level] >= minLevelOrder;
var logsToSend = [];
angular.forEach(logs, function (logEntry) {
if (LOG_LEVEL_ORDER[logEntry.level] >= minLevelOrder) {
logsToSend.push(logEntry);
}
});
logs.length = 0;
if (logsToSend.length > 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/javascript/cat-log-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ angular
}
};
var loggify = function (logger) {
_.each(['debug', 'info', 'warn', 'error'], function (level) {
angular.forEach(['debug', 'info', 'warn', 'error'], function (level) {
var methodLvlNumber = LOG_LEVEL_ORDER[level];
var log = function (message) {
if (LOG_LEVEL_ORDER[logger.resolveLevel()] <= methodLvlNumber) {
_.each(appenderList, function (appender) {
angular.forEach(appenderList, function (appender) {
var memorySizes;
if (dumpMemorySizes && window.performance && window.performance.memory) {
memorySizes = window.performance.memory;
Expand Down Expand Up @@ -143,7 +143,7 @@ angular
// instantiate root logger
var rootLogger = catLogService.Logger();

_.each(['debug', 'info', 'warn', 'error'], function (level) {
angular.forEach(['debug', 'info', 'warn', 'error'], function (level) {
$delegate[level] = rootLogger[level];
});
$delegate.Logger = catLogService.Logger;
Expand Down

0 comments on commit b6c25dc

Please sign in to comment.