Add a logging mode that takes a callback and flush'es to that callback.
Also add SB API's to set this callback, and to enable the log channels.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151018 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/lldb-log.cpp b/source/lldb-log.cpp
index b02dd25..4080bd8 100644
--- a/source/lldb-log.cpp
+++ b/source/lldb-log.cpp
@@ -98,20 +98,19 @@
}
void
-lldb_private::DisableLog (Args &args, Stream *feedback_strm)
+lldb_private::DisableLog (const char **categories, Stream *feedback_strm)
{
LogSP log(GetLog ());
if (log)
{
uint32_t flag_bits = 0;
- const size_t argc = args.GetArgumentCount ();
- if (argc > 0)
+ if (categories[0] != NULL)
{
flag_bits = log->GetMask().Get();
- for (size_t i = 0; i < argc; ++i)
+ for (size_t i = 0; categories[i] != NULL; ++i)
{
- const char *arg = args.GetArgumentAtIndex (i);
+ const char *arg = categories[i];
if (0 == ::strcasecmp(arg, "all")) flag_bits &= ~LIBLLDB_LOG_ALL;
else if (0 == ::strcasecmp(arg, "api")) flag_bits &= ~LIBLLDB_LOG_API;
@@ -155,7 +154,7 @@
}
LogSP
-lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
+lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const char **categories, Stream *feedback_strm)
{
// Try see if there already is a log - that way we can reuse its settings.
// We could reuse the log in toto, but we don't know that the stream is the same.
@@ -176,10 +175,9 @@
if (log)
{
bool got_unknown_category = false;
- const size_t argc = args.GetArgumentCount();
- for (size_t i=0; i<argc; ++i)
+ for (size_t i=0; categories[i] != NULL; ++i)
{
- const char *arg = args.GetArgumentAtIndex(i);
+ const char *arg = categories[i];
if (0 == ::strcasecmp(arg, "all")) flag_bits |= LIBLLDB_LOG_ALL;
else if (0 == ::strcasecmp(arg, "api")) flag_bits |= LIBLLDB_LOG_API;