This commit is contained in:
Evgeniy Dolzhenko 2010-09-03 04:26:20 -07:00
commit ff11f94045
7 changed files with 145 additions and 0 deletions

20
MIT-LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2008 [name of plugin creator]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
README Normal file
View File

@ -0,0 +1,9 @@
SilentPostgres
==============
Silences internal diagnostic messages from postgresql connection adapter.
Enabled only in development and test environments, skips production for
performance reasons - logging is probably disabled there anyway.
Copyright (c) 2008 Łukasz Piestrzeniewicz, released under the MIT license

5
init.rb Normal file
View File

@ -0,0 +1,5 @@
if %w(test development).include?(ENV["RAILS_ENV"])
puts "Silencing Postgres"
require 'silent_postgres'
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, SilentPostgres)
end

11
lib/.svn/all-wcprops Normal file
View File

@ -0,0 +1,11 @@
K 25
svn:wc:ra_dav:version-url
V 41
/svn/!svn/ver/3/trunk/silent_postgres/lib
END
silent_postgres.rb
K 25
svn:wc:ra_dav:version-url
V 60
/svn/!svn/ver/3/trunk/silent_postgres/lib/silent_postgres.rb
END

62
lib/.svn/entries Normal file
View File

@ -0,0 +1,62 @@
10
dir
3
http://silent-postgres.googlecode.com/svn/trunk/silent_postgres/lib
http://silent-postgres.googlecode.com/svn
2008-03-14T14:52:31.102621Z
3
bragi.ragnarson
af053fb6-6648-0410-933e-cf740565ad39
silent_postgres.rb
file
2010-09-03T11:25:36.000000Z
6f4fa5a46a0b65a32a942bfbc089b505
2008-03-14T14:46:41.921379Z
2
bragi.ragnarson
433

View File

@ -0,0 +1,19 @@
module SilentPostgres
SILENCED_METHODS = %w(tables indexes column_definitions pk_and_sequence_for last_insert_id)
def self.included(base)
SILENCED_METHODS.each do |m|
base.send :alias_method_chain, m, :silencer
end
end
SILENCED_METHODS.each do |m|
eval <<METHOD
def #{m}_with_silencer(*args)
@logger.silence do
#{m}_without_silencer(*args)
end
end
METHOD
end
end

19
lib/silent_postgres.rb Normal file
View File

@ -0,0 +1,19 @@
module SilentPostgres
SILENCED_METHODS = %w(tables indexes column_definitions pk_and_sequence_for last_insert_id)
def self.included(base)
SILENCED_METHODS.each do |m|
base.send :alias_method_chain, m, :silencer
end
end
SILENCED_METHODS.each do |m|
eval <<METHOD
def #{m}_with_silencer(*args)
@logger.silence do
#{m}_without_silencer(*args)
end
end
METHOD
end
end