# LogQuery.Builder
Date: 2012-02-24

## com.google.appengine.api.log
Class LogQuery.Builder

    java.lang.Object
      com.google.appengine.api.log.LogQuery.Builder

Enclosing class:
  LogQuery

    public static final class LogQuery.Builder

extends java.lang.Object

An object that builds LogQuery objects based on the possible query parameters for calls to `LogService.fetch(LogQuery)`, or its asynchronous counterpart `LogService#fetchAsync(LogQuery)`. Users should typically get the default LogQuery via `withDefaults()` and modify it as needed via the setters provided, or if only a single modification is needed, use the convenience methods provided (e.g., `withStartTimeUsec(long)`.

Constructor Summary
`LogQuery.Builder()`

Method Summary
`static LogQuery` `withBatchSize(int batchSize)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the number of items that a single underlying RPC should return.
`static LogQuery` `withDefaults()` Provides callers with a way to get a LogQuery object with only the default parameters set.
`static LogQuery` `withEndTimeUsec(long endTimeUsec)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the latest time (in microseconds since epoch) that returned requests should possess.
`static LogQuery` `withIncludeAppLogs(boolean includeAppLogs)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: whether or not application-level logs should be returned in the results.
`static LogQuery` `withIncludeIncomplete(boolean includeIncomplete)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: whether or not incomplete requests should be included in the results.
`static LogQuery` `withMajorVersionIds(java.util.List<java.lang.String> versionIds)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the major version IDs whose logs should be queried over.
`static LogQuery` `withMinLogLevel(LogService.LogLevel minLogLevel)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the minimum application log level.
`static LogQuery` `withOffset(java.lang.String offset)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: an offset into the log stream representing where the next read should begin.
`static LogQuery` `withStartTimeUsec(long startTimeUsec)` Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the earliest time (in microseconds since epoch) that returned requests should possess.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LogQuery.Builder

    public LogQuery.Builder()

Method Detail

### withOffset

    public static LogQuery withOffset(java.lang.String offset)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: an offset into the log stream representing where the next read should begin.

  Parameters:
    `offset` - The String representation of where the next result should be read from.
  Returns:
    A LogQuery that internally sets its offset to the user-provided one.

### withStartTimeUsec

    public static LogQuery withStartTimeUsec(long startTimeUsec)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the earliest time (in microseconds since epoch) that returned requests should possess. By default, this value is not set, which indicates a starting time at the epoch should be used when acquiring logs.

  Parameters:
    `startTimeUsec` - The earliest time (inclusive) for returned requests.
  Returns:
    A LogQuery that internally sets its starting time to the user-provided one.

### withEndTimeUsec

    public static LogQuery withEndTimeUsec(long endTimeUsec)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the latest time (in microseconds since epoch) that returned requests should possess. The latest time specified here is therefore checked against the starting time of results queried, since we are specifically interested in capturing the latest starting time for that request. By default, this value is not set, which indicates that the ending time should be set to the time when the fetch() call is made.

  Parameters:
    `endTimeUsec` - The latest time (exclusive) for returned requests.
  Returns:
    A LogQuery that internally sets its ending time to the user-provided one.

### withBatchSize

    public static LogQuery withBatchSize(int batchSize)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the number of items that a single underlying RPC should return.

  Parameters:
    `batchSize` - The number of items to be retrieved from the log storage system at a time.
  Returns:
    A LogQuery that internally sets its batch size to the user-provided one.

### withMinLogLevel

    public static LogQuery withMinLogLevel(LogService.LogLevel minLogLevel)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the minimum application log level. This means that any request log returned has at least one application log meeting or exceeding the minimum log level given (although it will contain all application logs for that request).

  Parameters:
    `minLogLevel` - The minimum application log level to search for in request logs.
  Returns:
    A LogQuery that internally sets the minimum log level to use to be the user-provided one.

### withIncludeIncomplete

    public static LogQuery withIncludeIncomplete(boolean includeIncomplete)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: whether or not incomplete requests should be included in the results. Incomplete requests are requests that are still in flight: that is, they have started to be processed but have not yet finished. By default, incomplete requests are excluded from queries.

  Parameters:
    `includeIncomplete` - Whether or not incomplete requests should be returned.
  Returns:
    A LogQuery that internally sets its includeIncomplete parameter to be the user-provided one.

### withIncludeAppLogs

    public static LogQuery withIncludeAppLogs(boolean includeAppLogs)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: whether or not application-level logs should be returned in the results. Note that request-level logs will always be returned, regardless of the value set here. By default, application-level logs are not included in queries.

  Parameters:
    `includeAppLogs` - Whether or not application-level logs should be included in the results.
  Returns:
    A LogQuery that internally sets its includeAppLogs parameter to be the user-provided one.

### withMajorVersionIds

    public static LogQuery withMajorVersionIds(java.util.List<java.lang.String> versionIds)

  Provides callers with a way to get a LogQuery object with only a single non-default parameter set: the major version IDs whose logs should be queried over. By default, the major version servicing the current request is set as the only version ID whose logs should be queried over.

  Parameters:
    `versionIds` - The list of major version IDs whose logs should be queried over.
  Returns:
    A LogQuery that internally sets the set of major version IDs to query over to be the user-provided one.

### withDefaults

    public static LogQuery withDefaults()

  Provides callers with a way to get a LogQuery object with only the default parameters set. The value of each default parameter is explained in that section's Builder method (e.g., the default value for versionIds is discussed in `withMajorVersionIds(List)`.

  Returns:
    A LogQuery with only the default parameters set.