Class: MCollective::Logger::Base

### Home Classes Methods

### In Files

- lib/mcollective/logger/base.rb

### Parent

Object

### Methods

- ::new
- #cycle_level
- #set_level

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::Logger::Base

A base class for logging providers.

Logging providers should provide the following:

    * start - all you need to do to setup your logging
    * set_logging_level - set your logging to :info, :warn, etc
    * valid_levels - a hash of maps from :info to your internal level name
    * log - what needs to be done to log a specific message

### Attributes

active_level[R]

### Public Instance Methods

cycle_level() click to toggle source

Figures out the next level and sets it

    # File lib/mcollective/logger/base.rb, line 24
    def cycle_level
      lvl = get_next_level
      set_level(lvl)

      log(lvl, "", "Logging level is now #{lvl.to_s.upcase}")
    end

set_level(level) click to toggle source

Sets a new level and record it in @active_level

    # File lib/mcollective/logger/base.rb, line 32
    def set_level(level)
      set_logging_level(level)
      @active_level = level.to_sym
    end

### Public Class Methods

new() click to toggle source

    # File lib/mcollective/logger/base.rb, line 14
    def initialize
      @known_levels = [:debug, :info, :warn, :error, :fatal]

      # Sanity check the class that impliments the logging
      @known_levels.each do |lvl|
        raise "Logger class did not specify a map for #{lvl}" unless valid_levels.include?(lvl)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.