Logging for multiple targets

Hi lldb-dev,

Looking at a log produced by multiple targets I hardly can find out which message corresponds to which target. I find a way to distinct them, e.g. by prepending messages with “[target_id]”. Putting an id to every message manually is not a choice obviously.

What do you think about having an optional target_id/execution_context inside the Log class or having an additional map with target-dependent logs? Maybe there are other options I missed?

Two problems that I can see:
* Log depends on no other part of LLDB. But nearly everything in LLDB depends on Log. So if we give Log a Target/ExeCtxt then all of LLDB would now depend on lldbTarget.
* IIRC our global log instance is shared between all debuggers/targets. So I'm not sure if adding a Target member would really help. We could make it a UID->Target map and pass down some target UID with each message, but then we might as well pass down a target itself. In both cases we would probably need to update all the logging code in LLDB.

The only solution that I can think of is having a Log wrapper class that prepends target information and we change all the GetLogIfAny/AllCategoriesSet that have a target in scope to call target.GetLogIfAllCategoriesSet (which would then return that Log wrapper). That wouldn't bring target ids to all log messages, but at least to all log messages that are aware of their target (and we would only need to update the `Log *log` initialisers but not all the LLDB_LOG statements itself).

Not sure if it's possible without hacks (like having a target ID in some TLS variable) to bring target ids to logging code that isn't aware of lldbTarget.

- Raphael