本文整理汇总了Java中com.google.cloud.logging.Logging.EntryListOption类的典型用法代码示例。如果您正苦于以下问题:Java EntryListOption类的具体用法?Java EntryListOption怎么用?Java EntryListOption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntryListOption类属于com.google.cloud.logging.Logging包,在下文中一共展示了EntryListOption类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.google.cloud.logging.Logging.EntryListOption; //导入依赖的package包/类
/** Expects an existing Stackdriver log name as an argument. */
public static void main(String... args) throws Exception {
// [START listlogs]
// Instantiates a client
LoggingOptions options = LoggingOptions.getDefaultInstance();
String logName = args[0];
try (Logging logging = options.getService()) {
String logFilter = "logName=projects/" + options.getProjectId() + "/logs/" + logName;
// List all log entries
Page<LogEntry> entries = logging.listLogEntries(
EntryListOption.filter(logFilter));
do {
for (LogEntry logEntry : entries.iterateAll()) {
System.out.println(logEntry);
}
entries = entries.getNextPage();
} while (entries != null);
}
// [END listlogs]
}