Skip to content

Look at alternative to the static Fields  #71

@stuart-warren

Description

@stuart-warren

The static Field Object has been questioned.
Look at how a log can be built another way.

SLF4J allows you to pass an Object[] along with the standard log message
eg:
logger.info("Test object array log", new Object[]{"tagnamehere", F.add(HTTP.REMOTE_USER, "valuehere")});
I can deal with that if you'd be happy to build an Object[], perhaps List would be tags, and Map<IFieldName,Object> would be fields.

Log4J is a bit different in that you could pass an Object[] as the message, I guess the first String in the array could be the log message, though I'm not sure if ordering is guaranteed.
eg:
logger.info(new Object[]{"log message", F.add(HTTP.REMOTE_USER, "valuehere")});

Maybe use static factory methods and the builder pattern to return an Object[]

logger.info("Log message here...", Log.new().field(HTTP.REMOTE, "valuehere").tag("tagname").build());

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions