Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping over FormatBlock #36

Closed
cornerman opened this issue Mar 1, 2018 · 2 comments
Closed

Mapping over FormatBlock #36

cornerman opened this issue Mar 1, 2018 · 2 comments

Comments

@cornerman
Copy link
Contributor

Before release 2.0 I had my threadname truncated which would remove a prefix like akka.actor.default-dispatcher with something shorter. As of now, I am not sure, how I would implement something like this (except implementing my own FormatBlock):

val formatter = FormatterBuilder()
    .add(l => "[" + l.threadName.replaceFirst("server-akka.actor.default-dispatcher-", "") + "]")
    .string(" ")
    .message.newLine

Can we have a def map(f: String => String): FormatBlock method in FormatBlock?

val truncatedThreadName = threadName.map(_.replaceFirst("server-akka.actor.default-dispatcher-", ""))
val logFormatter: Formatter = formatter"[${truncatedThreadName}] $message$newLine"
@darkfrog26
Copy link
Contributor

That's a good idea.

@darkfrog26
Copy link
Contributor

This was deployed and fixed in 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants