Skip to content

Commit

Permalink
Add Producer.withLogging1/Consumer.withLogging1 for binary compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Z1kkurat committed Aug 24, 2023
1 parent 5a4ef0f commit a94cd82
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,16 @@ object Consumer {
ConsumerLogging(log, self)
}

/** The sole purpose of this method is to support binary compatibility with an intermediate
* version (namely, 11.15.1) which had `withLogging` method using `MeasureDuration` from `smetrics`
* and `withLogging1` using `MeasureDuration` from `cats-helper`.
* This should not be used and should be removed in a reasonable amount of time.
*/
@deprecated("Use `withLogging`", since = "11.16.2")
def withLogging1(log: Log[F])(implicit F: Monad[F], measureDuration: MeasureDuration[F]): Consumer[F, K, V] = {
withLogging(log)
}

def mapK[G[_]](fg: F ~> G, gf: G ~> F)(implicit F: Monad[F]): Consumer[G, K, V] = new MapK with Consumer[G, K, V] {

def assign(partitions: Nes[TopicPartition]) = fg(self.assign(partitions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,35 @@ object Producer {
ProducerLogging(self, log)
}

/** The sole purpose of this method is to support binary compatibility with an intermediate
* version (namely, 11.15.1) which had `withLogging` method using `MeasureDuration` from `smetrics`
* and `withLogging1` using `MeasureDuration` from `cats-helper`.
* This should not be used and should be removed in a reasonable amount of time.
*/
@deprecated("Use `withLogging`", since = "11.16.2")
def withLogging1(log: Log[F])(implicit F: MonadThrow[F], measureDuration: MeasureDuration[F]): Producer[F] = {
withLogging(log)
}

/**
* @param charsToTrim a number of chars from record's value to log when producing fails because of a too large record
*/
def withLogging(log: Log[F], charsToTrim: Int)(implicit F: MonadThrow[F], measureDuration: MeasureDuration[F]): Producer[F] = {
ProducerLogging(self, log, charsToTrim)
}

/** The sole purpose of this method is to support binary compatibility with an intermediate
* version (namely, 11.15.1) which had `withLogging` method using `MeasureDuration` from `smetrics`
* and `withLogging1` using `MeasureDuration` from `cats-helper`.
* This should not be used and should be removed in a reasonable amount of time.
*
* @param charsToTrim a number of chars from record's value to log when producing fails because of a too large record
*/
@deprecated("Use `withLogging`", since = "11.16.2")
def withLogging1(log: Log[F], charsToTrim: Int)(implicit F: MonadThrow[F], measureDuration: MeasureDuration[F]): Producer[F] = {
withLogging(log, charsToTrim)
}

def withMetrics[E](
metrics: ProducerMetrics[F]
)(implicit F: MonadError[F, E], measureDuration: MeasureDuration[F]): Producer[F] = {
Expand Down

0 comments on commit a94cd82

Please sign in to comment.