Tizen 2.0 Release
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / grunt / node_modules / prompt / node_modules / winston / node_modules / loggly / lib / loggly / input.js
1 /*
2  * input.js: Instance of a single Loggly input
3  *
4  * (C) 2010 Nodejitsu Inc.
5  * MIT LICENSE
6  *
7  */
8  
9 var Input = exports.Input = function (client, details) {
10   if (!details) {
11     throw new Error("Input must be constructed with at least basic details.");
12   }
13   
14   this.client = client;
15   this._setProperties(details);
16 };
17
18 Input.prototype.log = function (msg, callback) {
19   return this.client.log(this.input_token, msg, callback);
20 };
21   
22 Input.prototype.addDevice = function (address, callback) {
23   this.client.addDeviceToInput(this.id, address, callback);
24 };
25   
26 //
27 // Sets the properties for this instance
28 // Parameters: details
29 //
30 Input.prototype._setProperties = function (details) {
31   // Copy the properties to this instance
32   var self = this;
33   Object.keys(details).forEach(function (key) {
34     self[key] = details[key];
35   });
36 };