项目作者: bmcustodio

项目描述 :
An RxJava hook which enables SLF4J's MDC propagation.
高级语言: Java
项目地址: git://github.com/bmcustodio/rxjava-slf4j-mdc-hook.git
创建时间: 2016-08-13T13:06:34Z
项目社区:https://github.com/bmcustodio/rxjava-slf4j-mdc-hook

开源协议:Apache License 2.0

下载


rxjava-slf4j-mdc-hook

Build Status
codecov

An
RxJava
hook
which enables
SLF4J‘s
MDC
propagation.

Usage

If you’re using RxJava ≥ 1.1.7:

  1. RxJavaHooks.setOnScheduleAction(new MdcPropagatingOnScheduleAction());

If you’re using RxJava ≤ 1.1.6:

  1. RxJavaPlugins.getInstance().registerSchedulersHook(new RxJavaSchedulersHook() {
  2. @Override
  3. public Action0 onSchedule(final Action0 action) {
  4. return new MdcPropagatingAction(action);
  5. }
  6. });

Note:
Both
RxJavaPlugins#getInstance()
and
RxJavaSchedulersHook#onSchedule(Action0)
are deprecated since 1.1.7.

Binaries

rxjava-slf4j-mdc-hook is available from both JCenter and Maven Central:

Gradle:

  1. compile 'io.github.bmcstdio:rxjava-slf4j-mdc-hook:1.1.2'

Maven:

  1. <dependency>
  2. <groupId>io.github.bmcstdio</groupId>
  3. <artifactId>rxjava-slf4j-mdc-hook</artifactId>
  4. <version>1.1.2</version>
  5. </dependency>

Building

  1. $ git clone https://github.com/brunomcustodio/rxjava-slf4j-mdc-hook.git
  2. $ cd rxjava-slf4j-mdc-hook
  3. $ ./gradlew build

License

Copyright 2016-2017 brunomcustodio

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  1. http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.