jlog-rails 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +7 -0
- data/jlog-rails.gemspec +0 -1
- data/lib/jlog/version.rb +1 -1
- data/vendor/assets/javascripts/appenders/ajax.js +8 -8
- data/vendor/assets/javascripts/helpers.js +39 -0
- data/vendor/assets/javascripts/jlog.js +1 -0
- data/vendor/assets/javascripts/layout.js +2 -2
- data/vendor/assets/javascripts/layouts/pattern.js +1 -3
- data/vendor/assets/javascripts/levels.js +1 -1
- data/vendor/assets/javascripts/logger.js +4 -3
- data/vendor/assets/javascripts/logging_event.js +1 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWIyNmJmYjViMmZkMzYwYmRmMzBiMWVkZjU2NGMyNWEyZDA3MmIwOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjFmOGRhYmNmZWRhYWQ4ZjliMTkxOTNhOTc0Y2Y3N2VmMjhjOWU0Yw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzdlNjlmMTQxMGE4NWQ0OThiZTg0ZmExOGI2ZGNmNTMzZWYzYzgyYTQxYTYx
|
10
|
+
NmVmODRhNGVlMzYxODIxOGNiNzE3YjhmZmZiZjFmYzQzYTcyNzUxNzk2ZWUy
|
11
|
+
MDBkOTEwN2EyZDIyMDA1ZTVjNjkxNTQ1ZDRlNDE0NDA1Y2QwNjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjllNmQ5YTdmYjBmMzk4Y2QzY2UyYmE5MjA5MDIyMGUxNjY5YTdhMjczNzY0
|
14
|
+
YjFhOWM3NGJkYzRlOTdkZDcyZGQ2OWIyMWU1ZjkxMjY2MDRkY2NjYzI1ZWFi
|
15
|
+
ODNhMTIwNTA4ODdhYWY3MDBlMDI3YmNkN2VhYjMzMzAxNDNiYTI=
|
data/README.md
CHANGED
@@ -22,8 +22,15 @@ On the client-side:
|
|
22
22
|
logger.addAppender(new JLog.AjaxAppender('/jlog/append'));
|
23
23
|
logger.warn('warning to be recorded in the server-side log');
|
24
24
|
|
25
|
+
Dependencies:
|
26
|
+
|
27
|
+
Underscore.JS
|
28
|
+
|
25
29
|
Changelog:
|
26
30
|
----------
|
31
|
+
* 0.2.1 Bugfix
|
32
|
+
* Added helpers to format Error backtraces
|
33
|
+
* Removed the just_underscore dependancy from gemspecs
|
27
34
|
* 0.2.0 Switching to use log4javascript code base
|
28
35
|
* Added LoggingEvent class to encapsulate log event.
|
29
36
|
* Added Appender and Layout base classes to format and output log events.
|
data/jlog-rails.gemspec
CHANGED
data/lib/jlog/version.rb
CHANGED
@@ -83,7 +83,7 @@ JLog.AjaxAppender = function(url) {
|
|
83
83
|
*/
|
84
84
|
this.setWaitForResponse = function(waitForResponseParam) {
|
85
85
|
waitForResponse = waitForResponseParam;
|
86
|
-
}
|
86
|
+
};
|
87
87
|
|
88
88
|
/*
|
89
89
|
Method: isWaitForResponse
|
@@ -92,7 +92,7 @@ JLog.AjaxAppender = function(url) {
|
|
92
92
|
*/
|
93
93
|
this.isWaitForResponse = function() {
|
94
94
|
return waitForResponse;
|
95
|
-
}
|
95
|
+
};
|
96
96
|
|
97
97
|
/*
|
98
98
|
Method: setBatchSize
|
@@ -104,7 +104,7 @@ JLog.AjaxAppender = function(url) {
|
|
104
104
|
*/
|
105
105
|
this.setBatchSize = function(batchSizeParam) {
|
106
106
|
batchSize = batchSizeParam;
|
107
|
-
}
|
107
|
+
};
|
108
108
|
|
109
109
|
/*
|
110
110
|
Method: getBatchSize
|
@@ -113,7 +113,7 @@ JLog.AjaxAppender = function(url) {
|
|
113
113
|
*/
|
114
114
|
this.getBatchSize = function() {
|
115
115
|
return batchSize;
|
116
|
-
}
|
116
|
+
};
|
117
117
|
|
118
118
|
/*
|
119
119
|
Method: setTimeout
|
@@ -124,8 +124,8 @@ JLog.AjaxAppender = function(url) {
|
|
124
124
|
timeout - milliseconds
|
125
125
|
*/
|
126
126
|
this.setBatchSize = function(timeout) {
|
127
|
-
timerInterval = timeout
|
128
|
-
}
|
127
|
+
timerInterval = timeout;
|
128
|
+
};
|
129
129
|
|
130
130
|
/*
|
131
131
|
Method: setTimeout
|
@@ -134,7 +134,7 @@ JLog.AjaxAppender = function(url) {
|
|
134
134
|
*/
|
135
135
|
this.getBatchSize = function() {
|
136
136
|
return timerInterval;
|
137
|
-
}
|
137
|
+
};
|
138
138
|
|
139
139
|
/*
|
140
140
|
Method: append
|
@@ -145,7 +145,7 @@ JLog.AjaxAppender = function(url) {
|
|
145
145
|
queuedLoggingEvents.push({level:msg.level.name, message:this.getLayout().format(msg)});
|
146
146
|
if(queuedLoggingEvents.length >= batchSize) sendAllRemaining();
|
147
147
|
else if(queuedLoggingEvents.length == 1) scheduleSending();
|
148
|
-
}
|
148
|
+
};
|
149
149
|
};
|
150
150
|
|
151
151
|
JLog.AjaxAppender.prototype = new JLog.Appender();
|
@@ -0,0 +1,39 @@
|
|
1
|
+
JLog.getExceptionMessage = function(ex) {
|
2
|
+
if (ex.message) {
|
3
|
+
return ex.message;
|
4
|
+
} else if (ex.description) {
|
5
|
+
return ex.description;
|
6
|
+
} else {
|
7
|
+
return String(ex);
|
8
|
+
}
|
9
|
+
};
|
10
|
+
|
11
|
+
// Gets the portion of the URL after the last slash
|
12
|
+
JLog.getUrlFileName = function (url) {
|
13
|
+
var lastSlashIndex = Math.max(url.lastIndexOf("/"), url.lastIndexOf("\\"));
|
14
|
+
return url.substr(lastSlashIndex + 1);
|
15
|
+
};
|
16
|
+
|
17
|
+
JLog.showStackTraces = true;
|
18
|
+
JLog.newLine = "\n";
|
19
|
+
|
20
|
+
// Returns a nicely formatted representation of an error
|
21
|
+
JLog.getExceptionStringRep = function (ex) {
|
22
|
+
if (ex) {
|
23
|
+
var exStr = "Exception: " + JLog.getExceptionMessage(ex);
|
24
|
+
try {
|
25
|
+
if (ex.lineNumber) {
|
26
|
+
exStr += " on line number " + ex.lineNumber;
|
27
|
+
}
|
28
|
+
if (ex.fileName) {
|
29
|
+
exStr += " in file " + JLog.getUrlFileName(ex.fileName);
|
30
|
+
}
|
31
|
+
} catch (localEx) {
|
32
|
+
}
|
33
|
+
if (JLog.showStackTraces && ex.stack) {
|
34
|
+
exStr += JLog.newLine + "Stack trace:" + JLog.newLine + ex.stack;
|
35
|
+
}
|
36
|
+
return exStr;
|
37
|
+
}
|
38
|
+
return null;
|
39
|
+
};
|
@@ -132,7 +132,7 @@ JLog.Layout.prototype = {
|
|
132
132
|
dataValues.push([this.millisecondsKey, loggingEvent.milliseconds]);
|
133
133
|
}
|
134
134
|
if(loggingEvent.exception) {
|
135
|
-
dataValues.push([this.exceptionKey, getExceptionStringRep(loggingEvent.exception)]);
|
135
|
+
dataValues.push([this.exceptionKey, JLog.getExceptionStringRep(loggingEvent.exception)]);
|
136
136
|
}
|
137
137
|
if(this.hasCustomFields()) {
|
138
138
|
for(var i = 0, len = this.customFields.length; i < len; i++) {
|
@@ -145,7 +145,7 @@ JLog.Layout.prototype = {
|
|
145
145
|
val = val(this, loggingEvent);
|
146
146
|
} catch(e) {
|
147
147
|
JLog.handleError(e);
|
148
|
-
val = "[Exception during evaluating]"
|
148
|
+
val = "[Exception during evaluating]";
|
149
149
|
}
|
150
150
|
|
151
151
|
dataValues.push([this.customFields[i].name, val]);
|
@@ -1,6 +1,4 @@
|
|
1
1
|
(function() {
|
2
|
-
var newLine = "\n";
|
3
|
-
|
4
2
|
/*
|
5
3
|
Class: PatternLayout
|
6
4
|
|
@@ -126,7 +124,7 @@
|
|
126
124
|
}
|
127
125
|
break;
|
128
126
|
case "n": // New line
|
129
|
-
replacement = newLine;
|
127
|
+
replacement = JLog.newLine;
|
130
128
|
break;
|
131
129
|
case "p": // Level
|
132
130
|
replacement = loggingEvent.level.name;
|
@@ -41,7 +41,7 @@
|
|
41
41
|
this.turnOff = function() { _enabled = false; };
|
42
42
|
this.isOn = function() { return _enabled; };
|
43
43
|
|
44
|
-
this.getName = function() { return _name; }
|
44
|
+
this.getName = function() { return _name; };
|
45
45
|
|
46
46
|
var _additive = true;
|
47
47
|
/*
|
@@ -228,7 +228,7 @@
|
|
228
228
|
};
|
229
229
|
|
230
230
|
this.toString = function() { return "Logger[" + this.getName() + "]"; };
|
231
|
-
}
|
231
|
+
}
|
232
232
|
|
233
233
|
Logger.prototype = {
|
234
234
|
/*
|
@@ -344,7 +344,8 @@
|
|
344
344
|
*/
|
345
345
|
JLog.getLogger = function(loggerName) {
|
346
346
|
// Use anonymous logger if loggerName is not specified or invalid
|
347
|
-
if (
|
347
|
+
if (typeof loggerName != "string")
|
348
|
+
loggerName = anonymousLoggerName;
|
348
349
|
|
349
350
|
// Do not allow retrieval of the root logger by name
|
350
351
|
if (loggerName == rootLoggerName)
|
@@ -64,7 +64,7 @@ JLog.LoggingEvent.prototype = {
|
|
64
64
|
Returns exception of the message as a String.
|
65
65
|
*/
|
66
66
|
getThrowableStrRep: function() {
|
67
|
-
return this.exception ? getExceptionStringRep(this.exception) : "";
|
67
|
+
return this.exception ? JLog.getExceptionStringRep(this.exception) : "";
|
68
68
|
},
|
69
69
|
|
70
70
|
/*
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jlog-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Helios Technologies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: just_underscore
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ! '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ! '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
description: A lightweight JavaScript logger (for Rails)
|
42
28
|
email: contact@heliostech.fr
|
43
29
|
executables: []
|
@@ -69,6 +55,7 @@ files:
|
|
69
55
|
- vendor/assets/javascripts/appender.js
|
70
56
|
- vendor/assets/javascripts/appenders/ajax.js
|
71
57
|
- vendor/assets/javascripts/appenders/console.js
|
58
|
+
- vendor/assets/javascripts/helpers.js
|
72
59
|
- vendor/assets/javascripts/jlog.js
|
73
60
|
- vendor/assets/javascripts/layout.js
|
74
61
|
- vendor/assets/javascripts/layouts/pattern.js
|