lib/og/connection.rb in og-0.7.0 vs lib/og/connection.rb in og-0.8.0
- old
+ new
@@ -2,11 +2,11 @@
# * George Moschovitis <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: connection.rb 167 2004-11-23 14:03:10Z gmosx $
-module Og;
+class Og;
require "glue/property"
require "glue/array"
require "glue/time"
@@ -36,18 +36,18 @@
#
def initialize(og)
@og = og
@db = @og.config[:backend].new(@og.config)
@deserialize = true
- $log.debug "Created DB connection."
+ Logger.debug "Created DB connection." if $DBG
end
# Close the connection to the database
#
def close()
@db.close()
- $log.debug "Closed DB connection."
+ Logger.debug "Closed DB connection." if $DBG
end
# Save an object to the database. Insert if this is a new object or
# update if this is already stored in the database.
#
@@ -250,16 +250,15 @@
begin
@db.start()
yield(@db)
@db.commit()
rescue => ex
- $log.error "DB Error: ERROR IN TRANSACTION"
- $log.error #{ex}
- $log.error #{ex.backtrace}
+ Logger.error "DB Error: ERROR IN TRANSACTION"
+ Logger.error #{ex}
+ Logger.error #{ex.backtrace}
@db.rollback()
end
end
end
-end # module
-
+end