google / google/flogger

Refactoring SimpleMessageFormatter

Open
#141 4 comments 0 reactions 0 assignees View on GitHub
P3 type=enhancement
Dominant language
Java
Stars
1.5k
Forks
133
Avg merge
6m
Merged PRs (30d)
7

Description

Hey folks,

Starting to contemplate untangling the various responsibilities in com.google.common.flogger.backend.SimpleMessageFormatter, will fork/branch here (no code created there yet): https://github.com/cslee00/flogger

From an initial review SimpleMessageFormatter has the below responsibilities; expecting that additional responsibilities will be identified as refactoring progresses.

1) Static utility methods to assist with message formatting;
2) Message "building" responsibilities inherited from MessageBuilder
3) Message argument handling responsibilities from ParameterVisitor interface implementation
4) Creating/formatting contextual information (tags & additional keys)
5) Dispatch created message to SimpleLogHandler interface
6) Orchestration of all the above

The tight coupling of these responsibilities prohibits composing solutions that use parts of these capabilities; for example, formatting the message template (w/ arguments) as text but passing all the other data (throwable, tags, etc) along to a back-end to handle.

Goal is to break apart this monolithic class into a few pieces with specific responsibilities such that they can be composed/orchestrated in different manners.

Thoughts / considerations welcome!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.