Permalink
Browse files

Added debug logging to Transaction.

  • Loading branch information...
1 parent 96f8c00 commit 75ce2e507080e3b9b40cbc2cf5c079e7fa0b0950 @randomcoder randomcoder committed Apr 15, 2012
View
6 core/src/main/scala/uk/co/randomcoding/partsdb/core/transaction/Transaction.scala
@@ -15,6 +15,7 @@ import net.liftweb.mongodb.record.field._
import net.liftweb.mongodb.record.{MongoRecord, MongoMetaRecord}
import org.joda.time.DateTime
+import net.liftweb.common.Logger
/**
* Encapsulates all the data for a transaction between the company and a customer.
@@ -108,7 +109,7 @@ class Transaction private() extends MongoRecord[Transaction] with ObjectIdPk[Tra
}
}
-object Transaction extends Transaction with MongoMetaRecord[Transaction] {
+object Transaction extends Transaction with MongoMetaRecord[Transaction] with Logger {
import com.foursquare.rogue.Rogue._
import org.bson.types.ObjectId
@@ -202,8 +203,11 @@ object Transaction extends Transaction with MongoMetaRecord[Transaction] {
*/
def close(oid: ObjectId): Option[Transaction] = {
val now = DateTime.now
+ debug("Closing transaction with id %s, setting completion date to %s".format(oid, now))
+ debug("There are %d transactions to modify".format(Transaction.where(_.id eqs oid).count))
Transaction where (_.id eqs oid) modify (_.completionDate setTo now.toDate) updateMulti
+ debug("Modified Transaction: %s".format(findById(oid)))
findById(oid)
}
}

0 comments on commit 75ce2e5

Please sign in to comment.