Permalink
Browse files

[fix] style and slight clarity fixes

  • Loading branch information...
1 parent d40e4c3 commit 36b39a370538deb9ba9e2f1c5474709107c8f767 @jcrugzz jcrugzz committed Dec 5, 2013
Showing with 11 additions and 8 deletions.
  1. +11 −8 lib/loggly/client.js
View
@@ -84,9 +84,15 @@ Loggly.prototype.log = function (msg, tags, callback) {
tags = null;
}
- var self = this;
- var isArray = Array.isArray(msg);
- var serialize = function(msg) {
+ var self = this,
+ logOptions;
+
+ //
+ // Remark: Have some extra logic for detecting if we want to make a bulk
+ // request to loggly
+ //
+ var isBulk = Array.isArray(msg);
+ function serialize (msg) {
if (msg instanceof Object) {
return self.json ? JSON.stringify(msg) : common.serialize(msg);
}
@@ -95,13 +101,10 @@ Loggly.prototype.log = function (msg, tags, callback) {
}
};
- msg = isArray ? msg.map(serialize).join('\n') : serialize(msg);
-
- var self = this,
- logOptions;
+ msg = isBulk ? msg.map(serialize).join('\n') : serialize(msg);
logOptions = {
- uri: isArray ? this.urls.bulk : this.urls.log,
+ uri: isBulk ? this.urls.bulk : this.urls.log,
method: 'POST',
body: msg,
headers: {

0 comments on commit 36b39a3

Please sign in to comment.