mirror of
				https://github.com/TheAnachronism/docspell.git
				synced 2025-11-03 18:00:11 +00:00 
			
		
		
		
	Use more prominent log line to indicate start of processing
Issue: #530
This commit is contained in:
		@@ -35,18 +35,20 @@ object ItemHandler {
 | 
				
			|||||||
      analyser: TextAnalyser[F],
 | 
					      analyser: TextAnalyser[F],
 | 
				
			||||||
      regexNer: RegexNerFile[F]
 | 
					      regexNer: RegexNerFile[F]
 | 
				
			||||||
  ): Task[F, Args, Unit] =
 | 
					  ): Task[F, Args, Unit] =
 | 
				
			||||||
    DuplicateCheck[F]
 | 
					    logBeginning.flatMap(_ =>
 | 
				
			||||||
      .flatMap(args =>
 | 
					      DuplicateCheck[F]
 | 
				
			||||||
        if (args.files.isEmpty) logNoFiles
 | 
					        .flatMap(args =>
 | 
				
			||||||
        else {
 | 
					          if (args.files.isEmpty) logNoFiles
 | 
				
			||||||
          val create: Task[F, Args, ItemData] =
 | 
					          else {
 | 
				
			||||||
            CreateItem[F].contramap(_ => args.pure[F])
 | 
					            val create: Task[F, Args, ItemData] =
 | 
				
			||||||
          create
 | 
					              CreateItem[F].contramap(_ => args.pure[F])
 | 
				
			||||||
            .flatMap(itemStateTask(ItemState.Processing))
 | 
					            create
 | 
				
			||||||
            .flatMap(safeProcess[F](cfg, itemOps, fts, analyser, regexNer))
 | 
					              .flatMap(itemStateTask(ItemState.Processing))
 | 
				
			||||||
            .map(_ => ())
 | 
					              .flatMap(safeProcess[F](cfg, itemOps, fts, analyser, regexNer))
 | 
				
			||||||
        }
 | 
					              .map(_ => ())
 | 
				
			||||||
      )
 | 
					          }
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def itemStateTask[F[_]: Sync, A](
 | 
					  def itemStateTask[F[_]: Sync, A](
 | 
				
			||||||
      state: ItemState
 | 
					      state: ItemState
 | 
				
			||||||
@@ -131,11 +133,16 @@ object ItemHandler {
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private def logWarn[F[_]](msg: => String): Task[F, Args, Unit] =
 | 
					  private def logWarn[F[_]](msg: => String): Task[F, Args, Unit] =
 | 
				
			||||||
    Task(_.logger.warn(msg))
 | 
					    Task.log(_.warn(msg))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private def logNoFiles[F[_]]: Task[F, Args, Unit] =
 | 
					  private def logNoFiles[F[_]]: Task[F, Args, Unit] =
 | 
				
			||||||
    logWarn(
 | 
					    logWarn(
 | 
				
			||||||
      "No files to process! Either no files were given or duplicate check removed all."
 | 
					      "No files to process! Either no files were given or duplicate check removed all."
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private def logBeginning[F[_]]: Task[F, Args, Unit] =
 | 
				
			||||||
 | 
					    Task { ctx =>
 | 
				
			||||||
 | 
					      val files = ctx.args.files.flatMap(_.name).mkString(", ")
 | 
				
			||||||
 | 
					      ctx.logger.info(s"============ Start processing $files ============")
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user