labath wrote:

> * Everyone (else) I talked to liked the idea of reusing the logging system 
> because that's what we already use and are familiar with. Promoting a log 
> message to be part of this log becomes as easy as adding a `GetLog` and using 
> the same macro.

I'm all for code reuse, and reusing some part of the logging machinery for this 
makes sense to me. The thing I'm not sure about is whether this is plugging 
into the machinery at the right level. The most irritating part is the 
`internal` flag -- like, we do all the motions to place the channel into the 
global log channel map (which is the source of truth for all user-facing log 
commands), but then set this flag which basically says "pretend this channel 
isn't here". 

I think this would look better if the flag wasn't there. Like, what if we had a 
separate way to create/register one of these "system" channels -- one which 
does not involve putting it in a list with all the other channels. Maybe the 
`Initialize` function could be something like:
```
Log g_system(g_system_channel);
g_system->Enable(...);
```
(The `Enable` function is currently private, but I think it would make sense to 
make it public, especially since it's possible (like you're effectively doing 
now) to bypass this restriction by calling the static string-based 
EnableLogChannel function. Alternatively, we could make the existence of this 
channel a feature of the generic log machinery (I expect we'll never want to 
have more than one of these), and then we can do this work from within 
`Log::Initialize`)

https://github.com/llvm/llvm-project/pull/108495
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to