1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8 <title>Class: MCollective::Logger::Syslog_logger</title>
10 <link rel="stylesheet" href="../../rdoc.css" type="text/css" media="screen" />
12 <script src="../../js/jquery.js" type="text/javascript"
13 charset="utf-8"></script>
14 <script src="../../js/thickbox-compressed.js" type="text/javascript"
15 charset="utf-8"></script>
16 <script src="../../js/quicksearch.js" type="text/javascript"
17 charset="utf-8"></script>
18 <script src="../../js/darkfish.js" type="text/javascript"
19 charset="utf-8"></script>
25 <div id="file-metadata">
26 <div id="file-list-section" class="section">
27 <h3 class="section-header">In Files</h3>
28 <div class="section-body">
31 <li><a href="../../lib/mcollective/logger/syslog_logger_rb.html?TB_iframe=true&height=550&width=785"
32 class="thickbox" title="lib/mcollective/logger/syslog_logger.rb">lib/mcollective/logger/syslog_logger.rb</a></li>
41 <div id="class-metadata">
45 <div id="parent-class-section" class="section">
46 <h3 class="section-header">Parent</h3>
48 <p class="link">Base</p>
53 <!-- Namespace Contents -->
56 <!-- Method Quickref -->
58 <div id="method-list-section" class="section">
59 <h3 class="section-header">Methods</h3>
60 <ul class="link-list">
62 <li><a href="#M000179">#log</a></li>
64 <li><a href="#M000177">#set_logging_level</a></li>
66 <li><a href="#M000175">#start</a></li>
68 <li><a href="#M000176">#syslog_facility</a></li>
70 <li><a href="#M000178">#valid_levels</a></li>
76 <!-- Included Modules -->
78 <div id="includes-section" class="section">
79 <h3 class="section-header">Included Modules</h3>
80 <ul class="link-list">
83 <li><span class="include">Syslog::Constants</span></li>
91 <div id="project-metadata">
94 <div id="fileindex-section" class="section project-section">
95 <h3 class="section-header">Files</h3>
98 <li class="file"><a href="../../COPYING.html">COPYING</a></li>
100 <li class="file"><a href="../../Gemfile.html">Gemfile</a></li>
102 <li class="file"><a href="../../README.html">README</a></li>
104 <li class="file"><a href="../../Rakefile.html">Rakefile</a></li>
106 <li class="file"><a href="../../etc/client_cfg_dist.html">client.cfg.dist</a></li>
108 <li class="file"><a href="../../etc/data-help_erb.html">data-help.erb</a></li>
110 <li class="file"><a href="../../etc/discovery-help_erb.html">discovery-help.erb</a></li>
112 <li class="file"><a href="../../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
114 <li class="file"><a href="../../etc/metadata-help_erb.html">metadata-help.erb</a></li>
116 <li class="file"><a href="../../etc/msg-help_erb.html">msg-help.erb</a></li>
118 <li class="file"><a href="../../etc/rpc-help_erb.html">rpc-help.erb</a></li>
120 <li class="file"><a href="../../etc/server_cfg_dist.html">server.cfg.dist</a></li>
122 <li class="file"><a href="../../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
124 <li class="file"><a href="../../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
126 <li class="file"><a href="../../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
128 <li class="file"><a href="../../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
130 <li class="file"><a href="../../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
132 <li class="file"><a href="../../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
134 <li class="file"><a href="../../lib/mcollective/locales/en_yml.html">en.yml</a></li>
136 <li class="file"><a href="../../mcollective_init.html">mcollective.init</a></li>
142 <div id="classindex-section" class="section project-section">
143 <h3 class="section-header">Class Index
144 <span class="search-toggle"><img src="../../images/find.png"
145 height="16" width="16" alt="[+]"
146 title="show/hide quicksearch" /></span></h3>
147 <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
149 <legend>Quicksearch</legend>
150 <input type="text" name="quicksearch" value=""
151 class="quicksearch-field" />
155 <ul class="link-list">
157 <li><a href="../../MCollective.html">MCollective</a></li>
159 <li><a href="../../MCollective/Agent.html">MCollective::Agent</a></li>
161 <li><a href="../../MCollective/Agents.html">MCollective::Agents</a></li>
163 <li><a href="../../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
165 <li><a href="../../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
167 <li><a href="../../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
169 <li><a href="../../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
171 <li><a href="../../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
173 <li><a href="../../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
175 <li><a href="../../MCollective/Application.html">MCollective::Application</a></li>
177 <li><a href="../../MCollective/Applications.html">MCollective::Applications</a></li>
179 <li><a href="../../MCollective/Cache.html">MCollective::Cache</a></li>
181 <li><a href="../../MCollective/Client.html">MCollective::Client</a></li>
183 <li><a href="../../MCollective/CodedError.html">MCollective::CodedError</a></li>
185 <li><a href="../../MCollective/Config.html">MCollective::Config</a></li>
187 <li><a href="../../MCollective/Connector.html">MCollective::Connector</a></li>
189 <li><a href="../../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
191 <li><a href="../../MCollective/DDL.html">MCollective::DDL</a></li>
193 <li><a href="../../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
195 <li><a href="../../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
197 <li><a href="../../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
199 <li><a href="../../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
201 <li><a href="../../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
203 <li><a href="../../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
205 <li><a href="../../MCollective/Data.html">MCollective::Data</a></li>
207 <li><a href="../../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
209 <li><a href="../../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
211 <li><a href="../../MCollective/Discovery.html">MCollective::Discovery</a></li>
213 <li><a href="../../MCollective/Facts.html">MCollective::Facts</a></li>
215 <li><a href="../../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
217 <li><a href="../../MCollective/Generators.html">MCollective::Generators</a></li>
219 <li><a href="../../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
221 <li><a href="../../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
223 <li><a href="../../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
225 <li><a href="../../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
227 <li><a href="../../MCollective/Log.html">MCollective::Log</a></li>
229 <li><a href="../../MCollective/Logger.html">MCollective::Logger</a></li>
231 <li><a href="../../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
233 <li><a href="../../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
235 <li><a href="../../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
237 <li><a href="../../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
239 <li><a href="../../MCollective/Matcher.html">MCollective::Matcher</a></li>
241 <li><a href="../../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
243 <li><a href="../../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
245 <li><a href="../../MCollective/Message.html">MCollective::Message</a></li>
247 <li><a href="../../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
249 <li><a href="../../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
251 <li><a href="../../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
253 <li><a href="../../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
255 <li><a href="../../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
257 <li><a href="../../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
259 <li><a href="../../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
261 <li><a href="../../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
263 <li><a href="../../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
265 <li><a href="../../MCollective/RPC.html">MCollective::RPC</a></li>
267 <li><a href="../../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
269 <li><a href="../../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
271 <li><a href="../../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
273 <li><a href="../../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
275 <li><a href="../../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
277 <li><a href="../../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
279 <li><a href="../../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
281 <li><a href="../../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
283 <li><a href="../../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
285 <li><a href="../../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
287 <li><a href="../../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
289 <li><a href="../../MCollective/RPCError.html">MCollective::RPCError</a></li>
291 <li><a href="../../MCollective/Registration.html">MCollective::Registration</a></li>
293 <li><a href="../../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
295 <li><a href="../../MCollective/Runner.html">MCollective::Runner</a></li>
297 <li><a href="../../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
299 <li><a href="../../MCollective/SSL.html">MCollective::SSL</a></li>
301 <li><a href="../../MCollective/Security.html">MCollective::Security</a></li>
303 <li><a href="../../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
305 <li><a href="../../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
307 <li><a href="../../MCollective/Shell.html">MCollective::Shell</a></li>
309 <li><a href="../../MCollective/Translatable.html">MCollective::Translatable</a></li>
311 <li><a href="../../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
313 <li><a href="../../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
315 <li><a href="../../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
317 <li><a href="../../MCollective/Util.html">MCollective::Util</a></li>
319 <li><a href="../../MCollective/Validator.html">MCollective::Validator</a></li>
321 <li><a href="../../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
323 <li><a href="../../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
325 <li><a href="../../Array.html">Array</a></li>
327 <li><a href="../../Dir.html">Dir</a></li>
329 <li><a href="../../Object.html">Object</a></li>
331 <li><a href="../../String.html">String</a></li>
333 <li><a href="../../Symbol.html">Symbol</a></li>
336 <div id="no-class-search-results" style="display: none;">No matching classes.</div>
343 <div id="documentation">
344 <h1 class="class">MCollective::Logger::Syslog_logger</h1>
346 <div id="description">
348 Implements a syslog based logger using the standard ruby syslog class
361 <div id="public-instance-method-details" class="method-section section">
362 <h3 class="section-header">Public Instance Methods</h3>
365 <div id="log-method" class="method-detail ">
366 <a name="M000179"></a>
368 <div class="method-heading">
370 <span class="method-name">log</span><span
371 class="method-args">(level, from, msg)</span>
372 <span class="method-click-advice">click to toggle source</span>
376 <div class="method-description">
378 <p class="missing-docs">(Not documented)</p>
382 <div class="method-source-code"
385 <span class="ruby-comment cmt"># File lib/mcollective/logger/syslog_logger.rb, line 42</span>
386 42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>(<span class="ruby-identifier">level</span>, <span class="ruby-identifier">from</span>, <span class="ruby-identifier">msg</span>)
387 43: <span class="ruby-constant">Syslog</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">map_level</span>(<span class="ruby-identifier">level</span>), <span class="ruby-node">"#{from} #{msg}"</span>)
388 44: <span class="ruby-keyword kw">rescue</span>
389 45: <span class="ruby-comment cmt"># if this fails we probably cant show the user output at all,</span>
390 46: <span class="ruby-comment cmt"># STDERR it as last resort</span>
391 47: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-node">"#{level}: #{msg}"</span>)
392 48: <span class="ruby-keyword kw">end</span></pre>
401 <div id="set-logging-level-method" class="method-detail ">
402 <a name="M000177"></a>
404 <div class="method-heading">
406 <span class="method-name">set_logging_level</span><span
407 class="method-args">(level)</span>
408 <span class="method-click-advice">click to toggle source</span>
412 <div class="method-description">
414 <p class="missing-docs">(Not documented)</p>
418 <div class="method-source-code"
419 id="set-logging-level-source">
421 <span class="ruby-comment cmt"># File lib/mcollective/logger/syslog_logger.rb, line 30</span>
422 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_logging_level</span>(<span class="ruby-identifier">level</span>)
423 31: <span class="ruby-comment cmt"># noop</span>
424 32: <span class="ruby-keyword kw">end</span></pre>
433 <div id="start-method" class="method-detail ">
434 <a name="M000175"></a>
436 <div class="method-heading">
438 <span class="method-name">start</span><span
439 class="method-args">()</span>
440 <span class="method-click-advice">click to toggle source</span>
444 <div class="method-description">
446 <p class="missing-docs">(Not documented)</p>
450 <div class="method-source-code"
453 <span class="ruby-comment cmt"># File lib/mcollective/logger/syslog_logger.rb, line 9</span>
454 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
455 10: <span class="ruby-identifier">config</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</span>
457 12: <span class="ruby-identifier">facility</span> = <span class="ruby-identifier">syslog_facility</span>(<span class="ruby-identifier">config</span>.<span class="ruby-identifier">logfacility</span>)
458 13: <span class="ruby-identifier">level</span> = <span class="ruby-identifier">config</span>.<span class="ruby-identifier">loglevel</span>.<span class="ruby-identifier">to_sym</span>
460 15: <span class="ruby-constant">Syslog</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Syslog</span>.<span class="ruby-identifier">opened?</span>
461 16: <span class="ruby-constant">Syslog</span>.<span class="ruby-identifier">open</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">$0</span>), <span class="ruby-value">3</span>, <span class="ruby-identifier">facility</span>)
463 18: <span class="ruby-identifier">set_level</span>(<span class="ruby-identifier">level</span>)
464 19: <span class="ruby-keyword kw">end</span></pre>
473 <div id="syslog-facility-method" class="method-detail ">
474 <a name="M000176"></a>
476 <div class="method-heading">
478 <span class="method-name">syslog_facility</span><span
479 class="method-args">(facility)</span>
480 <span class="method-click-advice">click to toggle source</span>
484 <div class="method-description">
486 <p class="missing-docs">(Not documented)</p>
490 <div class="method-source-code"
491 id="syslog-facility-source">
493 <span class="ruby-comment cmt"># File lib/mcollective/logger/syslog_logger.rb, line 21</span>
494 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">syslog_facility</span>(<span class="ruby-identifier">facility</span>)
495 22: <span class="ruby-keyword kw">begin</span>
496 23: <span class="ruby-constant">Syslog</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-node">"LOG_#{facility.upcase}"</span>)
497 24: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
498 25: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"Invalid syslog facility #{facility} supplied, reverting to USER"</span>
499 26: <span class="ruby-constant">Syslog</span><span class="ruby-operator">::</span><span class="ruby-constant">LOG_USER</span>
500 27: <span class="ruby-keyword kw">end</span>
501 28: <span class="ruby-keyword kw">end</span></pre>
510 <div id="valid-levels-method" class="method-detail ">
511 <a name="M000178"></a>
513 <div class="method-heading">
515 <span class="method-name">valid_levels</span><span
516 class="method-args">()</span>
517 <span class="method-click-advice">click to toggle source</span>
521 <div class="method-description">
523 <p class="missing-docs">(Not documented)</p>
527 <div class="method-source-code"
528 id="valid-levels-source">
530 <span class="ruby-comment cmt"># File lib/mcollective/logger/syslog_logger.rb, line 34</span>
531 34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid_levels</span>
532 35: {<span class="ruby-identifier">:info</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:info</span>,
533 36: <span class="ruby-identifier">:warn</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:warning</span>,
534 37: <span class="ruby-identifier">:debug</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:debug</span>,
535 38: <span class="ruby-identifier">:fatal</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:crit</span>,
536 39: <span class="ruby-identifier">:error</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:err</span>}
537 40: <span class="ruby-keyword kw">end</span></pre>
552 <div id="rdoc-debugging-section-dump" class="debugging-section">
554 <p>Disabled; run with --debug to generate this.</p>
558 <div id="validator-badges">
559 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
560 <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
561 Rdoc Generator</a> 1.1.6</small>.</p>