public class MongoLogService extends Object implements LifecycleListener, LogService
LogService.LogLevel| Modifier and Type | Field and Description |
|---|---|
static String |
COLLECTION_LOGS |
static String |
FIELD_DRIVER_ID |
static String |
FIELD_ID |
static String |
FIELD_LEVEL |
static String |
FIELD_MSG |
static String |
FIELD_TEST |
static String |
FIELD_TEST_RUN |
static String |
FIELD_TIME |
| Constructor and Description |
|---|
MongoLogService(com.mongodb.DB db,
int size,
int max,
int ttl)
Construct an instance providing the DB and collection name to use
|
| Modifier and Type | Method and Description |
|---|---|
com.mongodb.DBCursor |
getLogs(String driverId,
String test,
String testRun,
LogService.LogLevel level,
Long minTime,
Long maxTime,
int skip,
int limit)
Retrieve log messages in a cursor
|
void |
log(String driverId,
String test,
String testRun,
LogService.LogLevel level,
String msg)
Log a message
|
void |
start() |
void |
stop() |
public static final String COLLECTION_LOGS
public static final String FIELD_ID
public static final String FIELD_TIME
public static final String FIELD_DRIVER_ID
public static final String FIELD_TEST
public static final String FIELD_TEST_RUN
public static final String FIELD_LEVEL
public static final String FIELD_MSG
public MongoLogService(com.mongodb.DB db,
int size,
int max,
int ttl)
db - the database to usesize - the size (bytes) to cap the log size at or 0 to ignore.
This must be zero if the TTL is set.max - the maximum number of log entries or 0 to ignore.
This must be zero if the TTL is set.ttl - the time to live (seconds) of a log message or 0 to ignore.
This must be zero or less if the logs are capped by size or max entries.public void start()
start in interface LifecycleListenerpublic void stop()
stop in interface LifecycleListenerpublic void log(String driverId, String test, String testRun, LogService.LogLevel level, String msg)
LogServicelog in interface LogServicedriverId - the driver ID from which the message originated (optional)test - the name of the test (optional)testRun - the name of the test run (optional)level - the severity of the messagemsg - the log messagepublic com.mongodb.DBCursor getLogs(String driverId, String test, String testRun, LogService.LogLevel level, Long minTime, Long maxTime, int skip, int limit)
LogServicegetLogs in interface LogServicedriverId - driver ID (optional)test - the name of the test (optional)testRun - the name of the test run (optional)level - minimum severity (optional)minTime - minimum log message time (inclusive)maxTime - maximum log message time (exlusive)skip - number of results to skiplimit - limit the total number of resultsCopyright © 2005–2018 Alfresco Software. All rights reserved.