mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Adopt to new loggin api
This commit is contained in:
@ -17,6 +17,7 @@ import docspell.convert.ConversionResult.Handler
|
||||
import docspell.convert.extern._
|
||||
import docspell.convert.flexmark.Markdown
|
||||
import docspell.files.{ImageSize, TikaMimetype}
|
||||
import docspell.logging.Logger
|
||||
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
@ -46,7 +47,7 @@ object Conversion {
|
||||
val allPass = cfg.decryptPdf.passwords ++ additionalPasswords
|
||||
val pdfStream =
|
||||
if (cfg.decryptPdf.enabled) {
|
||||
logger.s
|
||||
logger.stream
|
||||
.debug(s"Trying to read the PDF using ${allPass.size} passwords")
|
||||
.drain ++
|
||||
in.through(RemovePdfEncryption(logger, allPass))
|
||||
|
@ -12,6 +12,7 @@ import cats.effect._
|
||||
import fs2.{Chunk, Pipe, Stream}
|
||||
|
||||
import docspell.common._
|
||||
import docspell.logging.Logger
|
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument
|
||||
import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException
|
||||
@ -36,7 +37,7 @@ object RemovePdfEncryption {
|
||||
.head
|
||||
.flatMap { doc =>
|
||||
if (doc.isEncrypted) {
|
||||
logger.s.debug("Removing protection/encryption from PDF").drain ++
|
||||
logger.stream.debug("Removing protection/encryption from PDF").drain ++
|
||||
Stream.eval(Sync[F].delay(doc.setAllSecurityToBeRemoved(true))).drain ++
|
||||
toStream[F](doc)
|
||||
} else {
|
||||
@ -44,7 +45,7 @@ object RemovePdfEncryption {
|
||||
}
|
||||
}
|
||||
.ifEmpty(
|
||||
logger.s
|
||||
logger.stream
|
||||
.info(
|
||||
s"None of the passwords helped to read the given PDF!"
|
||||
)
|
||||
@ -64,7 +65,8 @@ object RemovePdfEncryption {
|
||||
|
||||
val log =
|
||||
if (pw.isEmpty) Stream.empty
|
||||
else logger.s.debug(s"Try opening PDF with password: ${pw.pass.take(2)}***").drain
|
||||
else
|
||||
logger.stream.debug(s"Try opening PDF with password: ${pw.pass.take(2)}***").drain
|
||||
|
||||
in =>
|
||||
Stream
|
||||
|
@ -14,6 +14,7 @@ import fs2.{Pipe, Stream}
|
||||
import docspell.common._
|
||||
import docspell.convert.ConversionResult
|
||||
import docspell.convert.ConversionResult.{Handler, successPdf, successPdfTxt}
|
||||
import docspell.logging.Logger
|
||||
|
||||
private[extern] object ExternConv {
|
||||
|
||||
|
@ -13,6 +13,7 @@ import fs2.io.file.Path
|
||||
import docspell.common._
|
||||
import docspell.convert.ConversionResult
|
||||
import docspell.convert.ConversionResult.Handler
|
||||
import docspell.logging.Logger
|
||||
|
||||
object OcrMyPdf {
|
||||
|
||||
|
@ -13,6 +13,7 @@ import fs2.io.file.Path
|
||||
import docspell.common._
|
||||
import docspell.convert.ConversionResult
|
||||
import docspell.convert.ConversionResult.Handler
|
||||
import docspell.logging.Logger
|
||||
|
||||
object Tesseract {
|
||||
|
||||
|
@ -13,6 +13,7 @@ import fs2.io.file.Path
|
||||
import docspell.common._
|
||||
import docspell.convert.ConversionResult
|
||||
import docspell.convert.ConversionResult.Handler
|
||||
import docspell.logging.Logger
|
||||
|
||||
object Unoconv {
|
||||
|
||||
|
@ -16,6 +16,7 @@ import fs2.{Chunk, Stream}
|
||||
import docspell.common._
|
||||
import docspell.convert.ConversionResult.Handler
|
||||
import docspell.convert.{ConversionResult, SanitizeHtml}
|
||||
import docspell.logging.Logger
|
||||
|
||||
object WkHtmlPdf {
|
||||
|
||||
|
@ -20,12 +20,13 @@ import docspell.convert.extern.OcrMyPdfConfig
|
||||
import docspell.convert.extern.{TesseractConfig, UnoconvConfig, WkHtmlPdfConfig}
|
||||
import docspell.convert.flexmark.MarkdownConfig
|
||||
import docspell.files.ExampleFiles
|
||||
import docspell.logging.{Level, Logger}
|
||||
|
||||
import munit._
|
||||
|
||||
class ConversionTest extends FunSuite with FileChecks {
|
||||
|
||||
val logger = Logger.log4s[IO](org.log4s.getLogger)
|
||||
val logger = Logger.simpleF[IO](System.err, Level.Info)
|
||||
val target = File.path(Paths.get("target"))
|
||||
|
||||
val convertConfig = ConvertConfig(
|
||||
|
@ -11,11 +11,12 @@ import fs2.Stream
|
||||
|
||||
import docspell.common._
|
||||
import docspell.files.ExampleFiles
|
||||
import docspell.logging.{Level, Logger}
|
||||
|
||||
import munit.CatsEffectSuite
|
||||
|
||||
class RemovePdfEncryptionTest extends CatsEffectSuite with FileChecks {
|
||||
val logger: Logger[IO] = Logger.log4s(org.log4s.getLogger)
|
||||
val logger: Logger[IO] = Logger.simpleF[IO](System.err, Level.Info)
|
||||
|
||||
private val protectedPdf =
|
||||
ExampleFiles.secured_protected_test123_pdf.readURL[IO](16 * 1024)
|
||||
|
@ -16,12 +16,13 @@ import fs2.io.file.Path
|
||||
import docspell.common._
|
||||
import docspell.convert._
|
||||
import docspell.files.ExampleFiles
|
||||
import docspell.logging.{Level, Logger}
|
||||
|
||||
import munit._
|
||||
|
||||
class ExternConvTest extends FunSuite with FileChecks {
|
||||
val utf8 = StandardCharsets.UTF_8
|
||||
val logger = Logger.log4s[IO](org.log4s.getLogger)
|
||||
val logger = Logger.simpleF[IO](System.err, Level.Info)
|
||||
val target = File.path(Paths.get("target"))
|
||||
|
||||
test("convert html to pdf") {
|
||||
|
Reference in New Issue
Block a user