[SyncLogging] just logs don't return an IO
This commit is contained in:
parent
4cff0dd0c9
commit
44cf67c9cc
2 changed files with 5 additions and 5 deletions
|
@ -12,7 +12,7 @@ class Sync(s3Client: S3Client)
|
||||||
with SyncLogging {
|
with SyncLogging {
|
||||||
|
|
||||||
def run(implicit c: Config): IO[Unit] = {
|
def run(implicit c: Config): IO[Unit] = {
|
||||||
logRunStart(c).unsafeRunSync
|
logRunStart
|
||||||
listObjects(c.bucket, c.prefix)
|
listObjects(c.bucket, c.prefix)
|
||||||
.map { implicit s3ObjectsData => {
|
.map { implicit s3ObjectsData => {
|
||||||
val actions = for {
|
val actions = for {
|
||||||
|
@ -29,7 +29,7 @@ class Sync(s3Client: S3Client)
|
||||||
ioDelAction <- submitAction(ToDelete(key))
|
ioDelAction <- submitAction(ToDelete(key))
|
||||||
} yield ioDelAction).toStream.sequence
|
} yield ioDelAction).toStream.sequence
|
||||||
val delList = delActions.unsafeRunSync.toList
|
val delList = delActions.unsafeRunSync.toList
|
||||||
logRunFinished(list ++ delList).unsafeRunSync
|
logRunFinished(list ++ delList)
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@ import cats.effect.IO
|
||||||
// Logging for the Sync class
|
// Logging for the Sync class
|
||||||
trait SyncLogging extends Logging {
|
trait SyncLogging extends Logging {
|
||||||
|
|
||||||
def logRunStart(c: Config): IO[Unit] = IO {
|
def logRunStart(implicit c: Config): Unit =
|
||||||
log1(s"Bucket: ${c.bucket.name}, Prefix: ${c.prefix.key}, Source: ${c.source}, " +
|
log1(s"Bucket: ${c.bucket.name}, Prefix: ${c.prefix.key}, Source: ${c.source}, " +
|
||||||
s"Filter: ${c.filters.map{f => f.filter}.mkString(""", """)}")(c)
|
s"Filter: ${c.filters.map{f => f.filter}.mkString(""", """)}")(c)
|
||||||
}
|
|
||||||
|
|
||||||
def logRunFinished(actions: List[S3Action])
|
def logRunFinished(actions: List[S3Action])
|
||||||
(implicit c: Config): IO[Unit] = IO {
|
(implicit c: Config): Unit = {
|
||||||
val counters = actions.foldLeft(Counters())(logActivity)
|
val counters = actions.foldLeft(Counters())(logActivity)
|
||||||
log1(s"Uploaded ${counters.uploaded} files")
|
log1(s"Uploaded ${counters.uploaded} files")
|
||||||
log1(s"Copied ${counters.copied} files")
|
log1(s"Copied ${counters.copied} files")
|
||||||
|
|
Loading…
Reference in a new issue