Skip to content

log CPU starvation message as single line #3540

@mr-git

Description

@mr-git

Currently on Cats Effect 3.4.8, the CPU starvation message gets logged like:

2023-04-17T10:18:37.277Z [WARNING] Your app's responsiveness to a new asynchronous 
event (such as a new connection, an upstream response, or a timer) was in excess
of 5 milliseconds. Your CPU is probably starving. Consider increasing the 
granularity of your delays or adding more cedes. This may also be a sign that you
are unintentionally running blocking I/O operations (such as File or InetAddress)
without the blocking combinator.

As it gets written as multi-line entry, it breaks logging.

Please consider to print it as single line.

Probably something like following would work:

  private[this] def mkWarning(threshold: Duration)(when: FiniteDuration) =
    s"""|${format(when)} [WARNING] Your app's responsiveness to a new asynchronous
        | event (such as a new connection, an upstream response, or a timer) was in excess
        | of $threshold. Your CPU is probably starving. Consider increasing the
        | granularity of your delays or adding more cedes. This may also be a sign that you
        | are unintentionally running blocking I/O operations (such as File or InetAddress)
        | without the blocking combinator.""".stripMargin.replaceAll("\n", "")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions