I'm writing a file logging utility, using Rx buffer, for my Android app.
val logBuffer = PublishSubject.create<String>()
logBuffer
.observeOn(Schedulers.computation())
.buffer(10)
.subscribeOn(Schedulers.io())
.subscribe {
// write to file
}
It works well in normal use cases. Now, I want the ability to write/flush logs, on some specific event e.g. app kill or a specific error occurrence, even when buffer is not filled. Needed help in implementing the force emission of buffer. In my search, I was unable to find any related thing and additionally I'm new to Rx.