<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/god/diagnostics.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
 coverage
 pkg
 *.log
+logs</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,7 @@
+== 0.6.7 / 
+  * Minor Enhancements
+    * Add --no-syslog option to disable Syslog
+
 == 0.6.6 / 2008-01-07
   * Bug Fixes
     * Redo Timer mutexing to reduce synchronization needs</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ require 'optparse'
 require 'drb'
 
 begin
-  options = {:daemonize =&gt; true, :port =&gt; 17165}
+  options = {:daemonize =&gt; true, :port =&gt; 17165, :syslog =&gt; true}
 
   opts = OptionParser.new do |opts|
     opts.banner = &lt;&lt;-EOF
@@ -72,15 +72,19 @@ begin
       options[:info] = true
     end
     
-    opts.on(&quot;--log-level LEVEL&quot;, &quot;Log level [debug|info|fatal]&quot;) do |x|
+    opts.on(&quot;--log-level LEVEL&quot;, &quot;Log level [debug|info|warn|error|fatal]&quot;) do |x|
       options[:log_level] = x.to_sym
     end
+    
+    opts.on(&quot;--no-syslog&quot;, &quot;Disable output to syslog&quot;) do
+      options[:syslog] = false
+    end
   end
   
   opts.parse!
   
   # validate
-  if options[:log_level] &amp;&amp; ![:debug, :info, :fatal].include?(options[:log_level])
+  if options[:log_level] &amp;&amp; ![:debug, :info, :warn, :error, :fatal].include?(options[:log_level])
     abort(&quot;Invalid log level '#{options[:log_level]}'&quot;)
   end
   </diff>
      <filename>bin/god</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,6 @@ require 'stringio'
 require 'logger'
 
 # stdlib
-require 'syslog'
 
 # internal requires
 require 'god/errors'
@@ -58,6 +57,8 @@ require 'god/sugar'
 require 'god/cli/version'
 require 'god/cli/command'
 
+require 'god/diagnostics'
+
 $:.unshift File.join(File.dirname(__FILE__), *%w[.. ext god])
 
 # App wide logging system
@@ -76,13 +77,6 @@ $run ||= nil
 
 GOD_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
 
-# Ensure that Syslog is open
-begin
-  Syslog.open('god')
-rescue RuntimeError
-  Syslog.reopen('god')
-end
-
 # Return the binding of god's root level
 def root_binding
   binding
@@ -196,6 +190,8 @@ module God
     # log level
     log_level_map = {:debug =&gt; Logger::DEBUG,
                      :info =&gt; Logger::INFO,
+                     :warn =&gt; Logger::WARN,
+                     :error =&gt; Logger::ERROR,
                      :fatal =&gt; Logger::FATAL}
     LOG.level = log_level_map[self.log_level]
     
@@ -566,6 +562,8 @@ module God
     # mark as running
     self.running = true
     
+    # start_dike
+    
     # join the timer thread so we don't exit
     Timer.get.join
   end</diff>
      <filename>lib/god.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,13 +50,19 @@ module God
               God.pid = @options[:pid] 
             end
             
-            # set log level if requested
-            if @options[:log_level]
-              God.log_level = @options[:log_level]
+            unless @options[:syslog]
+              Logger.syslog = false
             end
             
             # load config
             if @options[:config]
+              # set log level, defaults to WARN
+              if @options[:log_level]
+                God.log_level = @options[:log_level]
+              else
+                God.log_level = :warn
+              end
+              
               unless File.exist?(@options[:config])
                 abort &quot;File not found: #{@options[:config]}&quot;
               end</diff>
      <filename>lib/god/cli/run.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,27 +9,48 @@ module God
     
     attr_accessor :logs
     
+    class &lt;&lt; self
+      attr_accessor :syslog
+    end
+    
+    self.syslog ||= true
+    
+    # Instantiate a new Logger object
     def initialize
       super($stdout)
       self.logs = {}
       @mutex = Mutex.new
       @capture = nil
+      load_syslog
     end
     
-    def start_capture
-      @mutex.synchronize do
-        @capture = StringIO.new
-      end
-    end
-    
-    def finish_capture
-      @mutex.synchronize do
-        cap = @capture.string
-        @capture = nil
-        cap
+    # If Logger.syslog is true then attempt to load the syslog bindings. If syslog
+    # cannot be loaded, then set Logger.syslog to false and continue.
+    #
+    # Returns nothing
+    def load_syslog
+      return unless Logger.syslog
+      
+      begin
+        require 'syslog'
+        
+        # Ensure that Syslog is open
+        begin
+          Syslog.open('god')
+        rescue RuntimeError
+          Syslog.reopen('god')
+        end
+      rescue Exception
+        Logger.syslog = false
       end
     end
     
+    # Log a message
+    #   +watch+ is the String name of the Watch (may be nil if not Watch is applicable)
+    #   +level+ is the log level [:debug|:info|:warn|:error|:fatal]
+    #   +text+ is the String message
+    #
+    # Returns nothing
     def log(watch, level, text)
       # initialize watch log if necessary
       self.logs[watch.name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT) if watch
@@ -49,9 +70,14 @@ module God
       self.send(level, text % [])
       
       # send to syslog
-      Syslog.send(SYSLOG_EQUIVALENTS[level], text)
+      Syslog.send(SYSLOG_EQUIVALENTS[level], text) if Logger.syslog
     end
     
+    # Get all log output for a given Watch since a certain Time.
+    #   +watch_name+ is the String name of the Watch
+    #   +since+ is the Time since which to fetch log lines
+    #
+    # Returns String
     def watch_log_since(watch_name, since)
       # initialize watch log if necessary
       self.logs[watch_name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT)
@@ -65,6 +91,29 @@ module God
         end.join
       end
     end
+    
+    # private
+    
+    # Enable capturing of log
+    #
+    # Returns nothing
+    def start_capture
+      @mutex.synchronize do
+        @capture = StringIO.new
+      end
+    end
+    
+    # Disable capturing of log and return what was captured since
+    # capturing was enabled with Logger#start_capture
+    #
+    # Returns String
+    def finish_capture
+      @mutex.synchronize do
+        cap = @capture.string
+        @capture = nil
+        cap
+      end
+    end
   end
   
 end
\ No newline at end of file</diff>
      <filename>lib/god/logger.rb</filename>
    </modified>
    <modified>
      <diff>@@ -89,6 +89,7 @@ module God
             applog(nil, :fatal, message)
           ensure
             # sleep until next check
+            GC.start
             sleep INTERVAL
           end
         end</diff>
      <filename>lib/god/timer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>220164aa09fbe0da9527c214d57836559b3bd602</id>
    </parent>
  </parents>
  <author>
    <name>tom</name>
    <email>tom@taco.desk.hq.powerset.com</email>
  </author>
  <url>http://github.com/mojombo/god/commit/8b62e3329ebcb21268175abf081136b586970c44</url>
  <id>8b62e3329ebcb21268175abf081136b586970c44</id>
  <committed-date>2008-01-10T11:27:36-08:00</committed-date>
  <authored-date>2008-01-10T11:27:36-08:00</authored-date>
  <message>add --no-syslog</message>
  <tree>660e508a4387072a7c1e853cfa01ecb02edf988e</tree>
  <committer>
    <name>tom</name>
    <email>tom@taco.desk.hq.powerset.com</email>
  </committer>
</commit>
