diff options
author | vlad <vlad@driver.xyz> | 2017-06-13 16:12:20 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-06-13 16:12:20 -0700 |
commit | cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c (patch) | |
tree | 062e8dad1a1513e26b0fd08b1742d6ff2ee874f7 /src/main/scala/xyz/driver/common/db/repositories/RepositoryLogging.scala | |
parent | 0000a65ab4479a2a40e2d6468036438e9705b4aa (diff) | |
download | rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.tar.gz rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.tar.bz2 rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.zip |
Adding domain entitiesv0.1.0
Diffstat (limited to 'src/main/scala/xyz/driver/common/db/repositories/RepositoryLogging.scala')
-rw-r--r-- | src/main/scala/xyz/driver/common/db/repositories/RepositoryLogging.scala | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/main/scala/xyz/driver/common/db/repositories/RepositoryLogging.scala b/src/main/scala/xyz/driver/common/db/repositories/RepositoryLogging.scala deleted file mode 100644 index cb2c438..0000000 --- a/src/main/scala/xyz/driver/common/db/repositories/RepositoryLogging.scala +++ /dev/null @@ -1,62 +0,0 @@ -package xyz.driver.common.db.repositories - -import xyz.driver.common.logging._ - -trait RepositoryLogging extends PhiLogging { - - protected def logCreatedOne[T](x: T)(implicit toPhiString: T => PhiString): T = { - logger.info(phi"An entity was created: $x") - x - } - - protected def logCreatedMultiple[T <: Iterable[_]](xs: T)(implicit toPhiString: T => PhiString): T = { - if (xs.nonEmpty) { - logger.info(phi"Entities were created: $xs") - } - xs - } - - protected def logUpdatedOne(rowsAffected: Long): Long = { - rowsAffected match { - case 0 => logger.trace(phi"The entity is up to date") - case 1 => logger.info(phi"The entity was updated") - case x => logger.warn(phi"The ${Unsafe(x)} entities were updated") - } - rowsAffected - } - - protected def logUpdatedOneUnimportant(rowsAffected: Long): Long = { - rowsAffected match { - case 0 => logger.trace(phi"The entity is up to date") - case 1 => logger.trace(phi"The entity was updated") - case x => logger.warn(phi"The ${Unsafe(x)} entities were updated") - } - rowsAffected - } - - protected def logUpdatedMultiple(rowsAffected: Long): Long = { - rowsAffected match { - case 0 => logger.trace(phi"All entities are up to date") - case x => logger.info(phi"The ${Unsafe(x)} entities were updated") - } - rowsAffected - } - - protected def logDeletedOne(rowsAffected: Long): Long = { - rowsAffected match { - case 0 => logger.trace(phi"The entity does not exist") - case 1 => logger.info(phi"The entity was deleted") - case x => logger.warn(phi"Deleted ${Unsafe(x)} entities, expected one") - } - rowsAffected - } - - protected def logDeletedMultiple(rowsAffected: Long): Long = { - rowsAffected match { - case 0 => logger.trace(phi"Entities do not exist") - case x => logger.info(phi"Deleted ${Unsafe(x)} entities") - } - rowsAffected - } - -} |