...
/Solution: Implement a Chainable Logger Config Builder
Solution: Implement a Chainable Logger Config Builder
Build a fluent config builder that conditionally assembles a nested logger configuration object, enforcing required output constraints.
We'll cover the following...
We'll cover the following...
Solution explanation
Lines 2–6: We initialize internal fields for
level,format, andoutputs, keeping all output targets organized under a single object.Lines 8–31: We define fluent setter methods that configure the logger—
setLevel,useJsonFormat, and the destination methods (toConsole,toFile,toRemote). Each updates the relevant field and returnsthisto enable chaining.Lines 34–40: In
.build()...