package com.github.davidmoten.rx.slf4j;

import static com.github.davidmoten.rx.slf4j.Logging.logger;
import static org.junit.Assert.assertEquals;

import org.junit.Test;

import rx.Observable;

import com.github.davidmoten.rx.slf4j.Logging.Level;

public class LoggingTest {

	@Test
	public void testName() {
		int count = Observable.range(1, 10)
		// log all
				.lift(logger(LoggingTest.class).value().log())
				// count
				.count().toBlockingObservable().single();
		assertEquals(10, count);
	}

	@Test
	public void testCountEvery() {
		int count = Observable
				.range(1, 10)
				// log all
				.lift(logger().name("rx.Server").prefix("count every test")
						.exclude().subscribed(Level.DEBUG)
						.onCompleted(Level.DEBUG).count().every(2).log())
				// count
				.count().toBlockingObservable().single();
		assertEquals(10, count);
	}

	@Test
	public void testAgain() {
		int count = Observable
				.range(51, 10)
				// log all
				.lift(logger().prefix("again ").every(5).count().memory().log())
				// count
				.count().toBlockingObservable().single();
		assertEquals(10, count);
	}

	@Test
	public void testCallingClass() {
		int count = Observable.range(1, 10)
		// log all
				.lift(logger().log())
				// count
				.count().toBlockingObservable().single();
		assertEquals(10, count);
	}
}

@@ -437,34 +437,24 @@
 ).toBlocking
-Observable
 ().single();
@@ -775,34 +775,24 @@
 ).toBlocking
-Observable
 ().single();
@@ -877,29 +877,24 @@
 = Observable
-%0A%09%09%09%09
 .range(51, 1
@@ -892,26 +892,24 @@
 nge(51, 10)%0A
-%09%09
 %09%09// log all
@@ -941,17 +941,16 @@
 x(%22again
- 
 %22).every
@@ -1009,34 +1009,24 @@
 ).toBlocking
-Observable
 ().single();
@@ -1211,26 +1211,16 @@
 Blocking
-Observable
 ().singl

change deprecated methods