17a26e85558166557e9cf368f1c34cfd7cbaac04.svn-base
30.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html> <html> <head> <title>core.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="../docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="..//loggly/common.html"> loggly/common.html </a> <a class="source" href="..//loggly/config.html"> loggly/config.html </a> <a class="source" href="..//loggly/core.html"> loggly/core.html </a> <a class="source" href="..//loggly/device.html"> loggly/device.html </a> <a class="source" href="..//loggly/facet.html"> loggly/facet.html </a> <a class="source" href="..//loggly/input.html"> loggly/input.html </a> <a class="source" href="..//loggly/search.html"> loggly/search.html </a> <a class="source" href="..//loggly.html"> loggly.html </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> core.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/*</span>
<span class="cm"> * core.js: Core functions for accessing Loggly</span>
<span class="cm"> *</span>
<span class="cm"> * (C) 2010 Nodejitsu Inc.</span>
<span class="cm"> * MIT LICENSE</span>
<span class="cm"> *</span>
<span class="cm"> */</span>
<span class="kd">var</span> <span class="nx">events</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'events'</span><span class="p">),</span>
<span class="nx">qs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'querystring'</span><span class="p">),</span>
<span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./config'</span><span class="p">),</span>
<span class="nx">common</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./common'</span><span class="p">),</span>
<span class="nx">Search</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./search'</span><span class="p">).</span><span class="nx">Search</span><span class="p">,</span>
<span class="nx">Facet</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./facet'</span><span class="p">).</span><span class="nx">Facet</span><span class="p">,</span>
<span class="nx">loggly</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'../loggly'</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">¶</a> </div> <p>function createClient (options)
Creates a new instance of a Loggly client.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">exports</span><span class="p">.</span><span class="nx">createClient</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="k">new</span> <span class="nx">Loggly</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">createConfig</span><span class="p">(</span><span class="nx">options</span><span class="p">));</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">¶</a> </div> <p>Loggly (config)
Constructor for the Loggly object</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">Loggly</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">.</span><span class="nx">Loggly</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">config</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">config</span> <span class="o">=</span> <span class="nx">config</span><span class="p">;</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">¶</a> </div> <p>function log (callback)
logs args to input device</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">log</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">inputId</span><span class="p">,</span> <span class="nx">msg</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">emitter</span> <span class="o">=</span> <span class="k">new</span> <span class="p">(</span><span class="nx">events</span><span class="p">.</span><span class="nx">EventEmitter</span><span class="p">)(),</span>
<span class="nx">message</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">msg</span> <span class="k">instanceof</span> <span class="nb">Object</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">message</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">json</span> <span class="o">?</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">msg</span><span class="p">)</span> <span class="o">:</span> <span class="nx">qs</span><span class="p">.</span><span class="nx">unescape</span><span class="p">(</span><span class="nx">qs</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">msg</span><span class="p">,</span> <span class="s1">','</span><span class="p">));</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">message</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">json</span> <span class="o">?</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">({</span> <span class="nx">message</span> <span class="o">:</span> <span class="nx">msg</span> <span class="p">})</span> <span class="o">:</span> <span class="nx">msg</span><span class="p">;</span>
<span class="p">}</span>
<span class="kd">var</span> <span class="nx">logOptions</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">uri</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">inputUrl</span> <span class="o">+</span> <span class="nx">inputId</span><span class="p">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="s1">'POST'</span><span class="p">,</span>
<span class="nx">body</span><span class="o">:</span> <span class="nx">message</span><span class="p">,</span>
<span class="nx">headers</span><span class="o">:</span> <span class="p">{</span>
<span class="s1">'Content-Type'</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">json</span> <span class="o">?</span> <span class="s1">'application/json'</span> <span class="o">:</span> <span class="s1">'text/plain'</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="nx">common</span><span class="p">.</span><span class="nx">loggly</span><span class="p">(</span><span class="nx">logOptions</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
<span class="k">try</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">body</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">result</span><span class="p">);</span>
<span class="p">}</span>
<span class="nx">emitter</span><span class="p">.</span><span class="nx">emit</span><span class="p">(</span><span class="s1">'log'</span><span class="p">,</span> <span class="nx">result</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">catch</span> <span class="p">(</span><span class="nx">ex</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">callback</span><span class="p">(</span><span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s1">'Unspecified error from Loggly: '</span> <span class="o">+</span> <span class="nx">ex</span><span class="p">));</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="k">return</span> <span class="nx">emitter</span><span class="p">;</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">¶</a> </div> <p>function search (query, callback)
Returns a new search object which can be chained
with options or called directly if @callback is passed
initially.</p>
<p>Sample Usage:</p>
<p>client.search('404')
.meta({ ip: '127.0.0.1' })
.context({ rows: 100 })
.run(function () { /* ... */ });</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">search</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">query</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="k">new</span> <span class="nx">Search</span><span class="p">(</span><span class="nx">query</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="nx">callback</span><span class="p">);</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">¶</a> </div> <p>function facet (facet, query, [options], callback)
Performs a facet search against loggly with the
specified facet, query and options.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">facet</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">facet</span><span class="p">,</span> <span class="nx">query</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="k">new</span> <span class="nx">Facet</span><span class="p">(</span><span class="nx">facet</span><span class="p">,</span> <span class="nx">query</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="nx">callback</span><span class="p">);</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">¶</a> </div> <p>function getInputs ([raw], callback)
Returns a list of all inputs for the authenicated account</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getInputs</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span>
<span class="nx">args</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">slice</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">arguments</span><span class="p">),</span>
<span class="nx">callback</span> <span class="o">=</span> <span class="nx">args</span><span class="p">.</span><span class="nx">pop</span><span class="p">(),</span>
<span class="nx">raw</span> <span class="o">=</span> <span class="nx">args</span><span class="p">.</span><span class="nx">length</span> <span class="o">></span> <span class="mi">0</span> <span class="o">?</span> <span class="nx">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">:</span> <span class="kc">false</span><span class="p">;</span>
<span class="nx">common</span><span class="p">.</span><span class="nx">loggly</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">logglyUrl</span><span class="p">(</span><span class="s1">'inputs'</span><span class="p">),</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">auth</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">inputs</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nx">results</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">body</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">raw</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">results</span><span class="p">.</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">inputs</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="k">new</span> <span class="p">(</span><span class="nx">loggly</span><span class="p">.</span><span class="nx">Input</span><span class="p">)(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">result</span><span class="p">));</span>
<span class="p">});</span>
<span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">inputs</span><span class="p">);</span>
<span class="p">}</span>
<span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">results</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">¶</a> </div> <p>function getInput (name, callback)
Returns the input with the specified name </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getInput</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">getInputs</span><span class="p">(</span><span class="kc">true</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">results</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">}</span>
<span class="kd">var</span> <span class="nx">matches</span> <span class="o">=</span> <span class="nx">results</span><span class="p">.</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">r</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">r</span><span class="p">.</span><span class="nx">name</span> <span class="o">===</span> <span class="nx">name</span> <span class="p">}),</span>
<span class="nx">input</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">matches</span><span class="p">.</span><span class="nx">length</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">input</span> <span class="o">=</span> <span class="k">new</span> <span class="p">(</span><span class="nx">loggly</span><span class="p">.</span><span class="nx">Input</span><span class="p">)(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">matches</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span>
<span class="p">}</span>
<span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">input</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">¶</a> </div> <p>function addDevice (inputId, address, callback)
Adds the device at address to the input specified by inputId</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">addDeviceToInput</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">inputId</span><span class="p">,</span> <span class="nx">address</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">addOptions</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">uri</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">logglyUrl</span><span class="p">(</span><span class="s1">'devices'</span><span class="p">),</span>
<span class="nx">auth</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">auth</span><span class="p">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="s1">'POST'</span><span class="p">,</span>
<span class="nx">headers</span><span class="o">:</span> <span class="p">{</span>
<span class="s1">'Content-Type'</span><span class="o">:</span> <span class="s1">'application/x-www-form-urlencoded'</span>
<span class="p">},</span>
<span class="nx">body</span><span class="o">:</span> <span class="nx">qs</span><span class="p">.</span><span class="nx">stringify</span><span class="p">({</span> <span class="s1">'input_id'</span><span class="o">:</span> <span class="nx">inputId</span><span class="p">,</span> <span class="s1">'ip'</span><span class="o">:</span> <span class="nx">address</span> <span class="p">}).</span><span class="nx">replace</span><span class="p">(</span><span class="s1">'"'</span><span class="p">,</span> <span class="s1">''</span><span class="p">)</span>
<span class="p">};</span>
<span class="nx">common</span><span class="p">.</span><span class="nx">loggly</span><span class="p">(</span><span class="nx">addOptions</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">res</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">¶</a> </div> <p>function addDevice (inputId, callback)
Adds the calling device to the input</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">addDevice</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">inputId</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">¶</a> </div> <p>Remark: This is not fully implemented yet</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">callback</span><span class="p">(</span><span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s1">'Not Implemented Yet...'</span><span class="p">));</span>
</pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">¶</a> </div> <p>common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) {
});</p> </td> <td class="code"> <div class="highlight"><pre><span class="p">};</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">¶</a> </div> <p>function getDevices (callback)
Returns a list of all devices for the authenicated account</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">getDevices</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
<span class="nx">common</span><span class="p">.</span><span class="nx">loggly</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">logglyUrl</span><span class="p">(</span><span class="s1">'devices'</span><span class="p">),</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">auth</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">results</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">body</span><span class="p">),</span>
<span class="nx">devices</span> <span class="o">=</span> <span class="p">[];</span>
<span class="nx">results</span><span class="p">.</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">devices</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="k">new</span> <span class="p">(</span><span class="nx">loggly</span><span class="p">.</span><span class="nx">Device</span><span class="p">)(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">result</span><span class="p">));</span>
<span class="p">});</span>
<span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">devices</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">¶</a> </div> <p>function logglyUrl ([path, to, resource])
Helper method that concats the string params into a url
to request against a loggly serverUrl. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Loggly</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">logglyUrl</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="cm">/* path, to, resource */</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">args</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">slice</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">arguments</span><span class="p">);</span>
<span class="k">return</span> <span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">logglyUrl</span><span class="p">].</span><span class="nx">concat</span><span class="p">(</span><span class="nx">args</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s1">'/'</span><span class="p">);</span>
<span class="p">};</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>