Skip to content

Instantly share code, notes, and snippets.

View edzhelyov's full-sized avatar

Evgeni Dzhelyov edzhelyov

  • Sofia, Bulgaria
View GitHub Profile
@edzhelyov
edzhelyov / better_logger.rb
Created August 9, 2012 11:28 — forked from indirect/better_logger.rb
Rails 3 logs with severity and PIDs
# You must require this file in application.rb, above the Application
# definition, for this to work. For example:
#
# # Syslog-like Rails logs
# if Rails.env.production?
# require File.expand_path('../../lib/better_logger', __FILE__)
# end
#
# module MyApp
# class Application < Rails::Application
require "thread"
$mutex = Mutex.new
$total = 0
def incr
$mutex.synchronize { $total += 1 }
sleep
end