public IObservable <string> Logcat(LogcatOptions options = LogcatOptions.None, LogOutputFormat format = LogOutputFormat.Brief, CancellationToken cancellationToken = default(CancellationToken), params LogFilter[] filters) { using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken)) { string formatString = format == LogOutputFormat.Brief ? string.Empty : string.Format("-v {0}", format.ToString().ToLower()); string filtersString = filters.Aggregate("", (acc, f) => acc + " " + f.ToString()); var process = new Adb(this, "logcat {0} {1} {2}", options.GenerateString(), formatString, filtersString).CreateProcess(AdbExecutablePath, cts, 0, false); process.RunAsync(cts.Token); return(process.Output); } }
public static string GenerateString(this LogcatOptions options) { string optionsString = string.Empty; if ((options & LogcatOptions.ClearLogAndExit) != 0) { optionsString += " -c"; } if ((options & LogcatOptions.DumpAndExit) != 0) { optionsString += " -d"; } if ((options & LogcatOptions.PrintSizeAndExit) != 0) { optionsString += " -g"; } if ((options & LogcatOptions.DefaultSilent) != 0) { optionsString += " -s"; } return(optionsString); }