Skip to content

Commit e592634

Browse files
author
Samuel Mills (Henchman)
committed
v1.2.2 - Replaced source with "SlackAPI", and forced it for all logs.
1 parent 89c6a91 commit e592634

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ var token = '';
2323
var logging;
2424

2525
// Core functions
26-
var out = function(severity, source, message) {
26+
var out = function(severity, message) {
2727
if (logging) {
28-
logger(severity, source, message);
28+
logger(severity, "SlackAPI", message);
2929
}
3030
};
3131

@@ -106,11 +106,11 @@ var sendSock = function(data) {
106106
if (typeof data !== "undefined") {
107107
data.id = i;
108108
data = JSON.stringify(data);
109-
out("debug", "Sender", "Send: "+data);
109+
out("debug", "Send: "+data);
110110
this.ws.send(data);
111111
i++;
112112
} else {
113-
out('error', 'Sender', 'Send: No arguments specified!');
113+
out('error', 'Send: No arguments specified!');
114114
}
115115
};
116116

@@ -119,16 +119,16 @@ function slackAPI(args) {
119119
var authtoken = args['token'];
120120
if (typeof args !== 'object') {
121121
logging = true;
122-
out('error', 'Slack API', 'Invalid arguments! Please provide an object with settings.');
122+
out('error', 'Invalid arguments! Please provide an object with settings.');
123123
process.exit(1);
124124
} if (typeof args['logging'] !== 'boolean') {
125125
logging = true;
126-
out('error', 'Slack API', 'Invalid arguments! Please provide a valid boolean for logging.');
126+
out('error', 'Invalid arguments! Please provide a valid boolean for logging.');
127127
} else {
128128
logging = args['logging'];
129129
} if (!authtoken || typeof authtoken !== 'string' || !authtoken.match(/^([a-z]*)\-([0-9]*)\-([0-9a-zA-Z]*)/)) {
130130
logging = true;
131-
out('error', 'Slack API', 'Invalid arguments! Please provide a valid auth token.');
131+
out('error', 'Invalid arguments! Please provide a valid auth token.');
132132
process.exit(1);
133133
}
134134

@@ -163,16 +163,16 @@ slackAPI.prototype.connectSlack = function(wsurl, cb) {
163163
var self = this;
164164
self.ws = new webSocket(wsurl);
165165
self.ws.on('open', function() {
166-
out('transport', 'Socket', 'Connected as '+slackData.self.name+' ['+slackData.self.id+'].');
166+
out('transport', 'Connected as '+slackData.self.name+' ['+slackData.self.id+'].');
167167
self.emit("open")
168168
}).on('close', function(data) {
169-
out('warning', 'Socket', 'Disconnected. Error: '+data);
169+
out('warning', 'Disconnected. Error: '+data);
170170
self.emit("close", data)
171171
}).on('error', function(data) {
172-
out('error', 'Socket', 'Error. Error: '+data);
172+
out('error', 'Error. Error: '+data);
173173
self.emit("error", data)
174174
}).on('message', function(data) {
175-
out('transport', 'Socket', "Recieved: " + data);
175+
out('transport', "Recieved: " + data);
176176
data = JSON.parse(data);
177177
if (typeof data.type != 'undefined'){
178178
if (typeof events[data.type] !== 'undefined') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slackbotapi",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "a node.js API using Slack their RTM API",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)