Let's say I have a static method called Logger.log(), which calls another static method, CurrentUser.getName(), to get some additional information to log:
public static void log(text) {
String[] itemsToLog = { text, todaysDate, ipAddress, CurrentUser.getName() };
Now obviously this isn't an ideal situation, especially with the static data in the CurrentUser class. But I want to start improving it by reducing the Logger's dependencies. I'd prefer that the Logger not have any knowledge of higher-level concepts like users. It just needs a list of things to log, and doesn't care what they are.
So I want to somehow factor out the CurrentUser class. But Logger is static, so I can't just pass the information into its constructor.
What would be a good pattern for factoring out things like this?