Skip to content

Commit

Permalink
refactor: use non deprecated log4cats api
Browse files Browse the repository at this point in the history
  • Loading branch information
ingarabr committed May 3, 2023
1 parent ef4c296 commit ebfd562
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import com.google.cloud.bigquery.DatasetId
import com.google.cloud.bigquery.datatransfer.v1._
import com.google.protobuf.{Struct, Value}
import no.nrk.bigquery.BigQueryTransferClient.{TransferConfigFailed, TransferFailed, TransferStatus, TransferSucceeded}
import org.typelevel.log4cats.slf4j.{Slf4jFactory, loggerFactoryforSync}
import org.typelevel.log4cats.slf4j.Slf4jFactory

import scala.concurrent.duration.{DurationInt, FiniteDuration}
import scala.jdk.CollectionConverters._

class BigQueryTransferClient(transferClient: DataTransferServiceClient) {
protected lazy val logger = Slf4jFactory.getLogger[IO]
protected lazy val logger = Slf4jFactory.create[IO].getLogger

def getTransferConfig(
transferConfigName: TransferConfigName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import no.nrk.bigquery._
import no.nrk.bigquery.testing.BQSmokeTest.{CheckType, bqCheckFragment}
import org.typelevel.log4cats.slf4j._
import no.nrk.bigquery.syntax._
import org.typelevel.log4cats.SelfAwareStructuredLogger

import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Path}
Expand Down Expand Up @@ -216,7 +217,7 @@ abstract class BQSmokeTest(testClient: Resource[IO, BigQueryClient[IO]]) extends
}

object BQSmokeTest {
private val logger = Slf4jFactory.getLogger[IO]
private val logger: SelfAwareStructuredLogger[IO] = Slf4jFactory.create[IO].getLogger

def bqCheckFragment(
testName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract class BQUdfSmokeTest(testClient: Resource[IO, BigQueryClient[IO]]) exte
}

object BQUdfSmokeTest {
private val logger = Slf4jFactory.getLogger[IO]
private val logger = Slf4jFactory.create[IO].getLogger

object `udf-results` extends GeneratedTest {
override def testType: String = "udf-results"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import no.nrk.bigquery.metrics.MetricsOps
import org.apache.avro
import org.apache.avro.file.{DataFileReader, DataFileWriter}
import org.apache.avro.generic.{GenericDatumReader, GenericDatumWriter, GenericRecord}
import org.typelevel.log4cats.LoggerFactory
import org.typelevel.log4cats.slf4j._
import org.typelevel.log4cats.SelfAwareStructuredLogger
import org.typelevel.log4cats.slf4j.Slf4jFactory

import java.io.ByteArrayInputStream
import java.nio.charset.StandardCharsets
Expand All @@ -21,6 +21,9 @@ import scala.jdk.CollectionConverters._
import scala.util.Properties

object BigQueryTestClient {
private implicit val loggerFactory: Slf4jFactory[IO] = Slf4jFactory.create[IO]
private val logger: SelfAwareStructuredLogger[IO] = loggerFactory.getLogger

val basedir =
Paths
.get(sys.env.getOrElse("BIGQUERY_HOME", Properties.userHome))
Expand Down Expand Up @@ -52,8 +55,6 @@ object BigQueryTestClient {
underlying <- BigQueryClient.resource(credentials, MetricsOps.noop[IO])
} yield underlying

private val logger = LoggerFactory.getLogger[IO]

def cachingClient(
cacheFrom: Resource[IO, BigQueryClient[IO]]
): Resource[IO, BigQueryClient[IO]] =
Expand Down

0 comments on commit ebfd562

Please sign in to comment.