Package com.epam.reportportal.service
Class LoggingContext
- java.lang.Object
-
- com.epam.reportportal.service.LoggingContext
-
public class LoggingContext extends java.lang.ObjectLogging context holds thread-local context for logging and convertsSaveLogRQto multipart HTTP request to ReportPortal Basic flow: After start some test item (suite/test/step) context should be initialized with observable of item ID and ReportPortal client. Before actual finish of test item, context should be closed/completed. Context consists ofFlowablewith buffering back-pressure strategy to be able to batch incoming log messages into one request- See Also:
init(Maybe)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LoggingContextcontext()Return current logging context attached to the current thread.static LoggingContextdispose()Disposes current logging contextvoidemit(io.reactivex.Maybe<java.lang.String> logItemUuid, java.util.function.Function<java.lang.String,SaveLogRQ> logSupplier)Emits log.voidemit(java.util.function.Function<java.lang.String,SaveLogRQ> logSupplier)Emits log.static LoggingContextinit(io.reactivex.Maybe<java.lang.String> itemUuid)Initializes new logging context and attaches it to current thread
-
-
-
Method Detail
-
context
@Nullable public static LoggingContext context()
Return current logging context attached to the current thread. Return parent thread context if self context not found. And return 'null' if nothing was found at all.- Returns:
- current or parent logging context or 'null'
-
init
@Nonnull public static LoggingContext init(@Nonnull io.reactivex.Maybe<java.lang.String> itemUuid)
Initializes new logging context and attaches it to current thread- Parameters:
itemUuid- a Test Item UUID- Returns:
- New Logging Context
-
dispose
@Nullable public static LoggingContext dispose()
Disposes current logging context- Returns:
- Disposed Logging Context or 'null' if no context was found
-
emit
public void emit(@Nonnull io.reactivex.Maybe<java.lang.String> logItemUuid, @Nonnull java.util.function.Function<java.lang.String,SaveLogRQ> logSupplier)Emits log. Basically, put it into processing pipeline- Parameters:
logItemUuid- Test Item ID promiselogSupplier- Log Message Factory. Key if the function is actual test item ID
-
emit
public void emit(@Nonnull java.util.function.Function<java.lang.String,SaveLogRQ> logSupplier)Emits log. Basically, put it into processing pipeline- Parameters:
logSupplier- Log Message Factory. Key if the function is actual test item ID
-
-