Skip to content

fix: Update the definition of 'logcatFilterSpecs' option #2258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,36 @@
import io.appium.java_client.remote.options.CanSetCapability;
import org.openqa.selenium.Capabilities;

import java.util.List;
import java.util.Optional;

public interface SupportsLogcatFilterSpecsOption<T extends BaseOptions<T>> extends
Capabilities, CanSetCapability<T> {
String LOGCAT_FILTER_SPECS_OPTION = "logcatFilterSpecs";

/**
* Series of tag[:priority] where tag is a log component tag (or * for all)
* and priority is: V Verbose, D Debug, I Info, W Warn, E Error, F Fatal,
* S Silent (supress all output). '' means ':d' and tag by itself means tag:v.
* If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
* If no filterspec is found, filter defaults to '*:I'.
* Allows to customize logcat output filtering.
*
* @param format The filter specifier.
* @param format The filter specifier. Consists from series of `tag[:priority]` items,
* where `tag` is a log component tag (or `*` to match any value)
* and `priority`: V (Verbose), D (Debug), I (Info), W (Warn), E (Error), F (Fatal),
* S (Silent - supresses all output). `tag` without `priority` defaults to `tag:v`.
* If not specified, filterspec is set from ANDROID_LOG_TAGS environment variable.
* If no filterspec is found, filter defaults to `*:I`, which means
* to only show log lines with any tag and the log level INFO or higher.
* @return self instance for chaining.
*/
default T setLogcatFilterSpecs(String format) {
default T setLogcatFilterSpecs(List<String> format) {
return amend(LOGCAT_FILTER_SPECS_OPTION, format);
}

/**
* Get the logcat filter format.
*
* @return Format specifier.
* @return Format specifier. See the documentation on {@link #setLogcatFilterSpecs(List)} for more details.
*/
default Optional<String> getLogcatFilterSpecs() {
return Optional.ofNullable((String) getCapability(LOGCAT_FILTER_SPECS_OPTION));
default Optional<List<String>> getLogcatFilterSpecs() {
//noinspection unchecked
return Optional.ofNullable((List<String>) getCapability(LOGCAT_FILTER_SPECS_OPTION));
}
}
Loading