-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve logging system to filter markers #1270
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ import java.util.concurrent.TimeUnit | |
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
|
||
enum class CoinJoinMode { | ||
NONE, | ||
INTERMEDIATE, | ||
|
@@ -120,7 +121,7 @@ class CoinJoinMixingService @Inject constructor( | |
val log: Logger = LoggerFactory.getLogger(CoinJoinMixingService::class.java) | ||
const val DEFAULT_MULTISESSION = false // for stability, need to investigate | ||
const val DEFAULT_ROUNDS = 4 | ||
const val DEFAULT_SESSIONS = 4 | ||
const val DEFAULT_SESSIONS = 6 | ||
Comment on lines
-123
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the only speed related changed in this PR. |
||
const val DEFAULT_DENOMINATIONS_GOAL = 50 | ||
const val DEFAULT_DENOMINATIONS_HARDCAP = 300 | ||
|
||
|
@@ -188,6 +189,7 @@ class CoinJoinMixingService @Inject constructor( | |
override fun observeMixingProgress(): Flow<Double> = _progressFlow | ||
|
||
init { | ||
//initLogging() | ||
blockchainStateProvider.observeNetworkStatus() | ||
.filterNot { it == NetworkStatus.UNKNOWN } | ||
.onEach { status -> | ||
|
@@ -250,7 +252,7 @@ class CoinJoinMixingService @Inject constructor( | |
} | ||
} | ||
|
||
suspend fun getCurrentTimeSkew(): Long { | ||
private suspend fun getCurrentTimeSkew(): Long { | ||
return try { | ||
getTimeSkew() | ||
} catch (e: Exception) { | ||
|
@@ -404,7 +406,6 @@ class CoinJoinMixingService @Inject constructor( | |
message: PoolMessage? | ||
) { | ||
super.onSessionStarted(wallet, sessionId, denomination, message) | ||
log.info("Session started: {}. {}% mixed. {} active sessions", sessionId, progress, activeSessions + 1) | ||
updateActiveSessions() | ||
} | ||
|
||
|
@@ -418,13 +419,11 @@ class CoinJoinMixingService @Inject constructor( | |
joined: Boolean | ||
) { | ||
super.onSessionComplete(wallet, sessionId, denomination, state, message, address, joined) | ||
log.info("Session completed: {}. {}% mixed. {} active sessions", sessionId, progress, activeSessions - 1) | ||
updateActiveSessions() | ||
} | ||
|
||
override fun onTransactionProcessed(tx: Transaction?, type: CoinJoinTransactionType?, sessionId: Int) { | ||
super.onTransactionProcessed(tx, type, sessionId) | ||
log.info("coinjoin-tx {} in session {} {}", type, sessionId, tx?.txId) | ||
coroutineScope.launch { | ||
updateProgress() | ||
} | ||
|
@@ -652,7 +651,7 @@ class CoinJoinMixingService @Inject constructor( | |
} else { | ||
0 | ||
} | ||
log.info("coinjoin-activeSessions: {}", activeSessions) | ||
// log.info("coinjoin-activeSessions: {}", activeSessions) | ||
activeSessionsFlow.emit(activeSessions) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.schildbach.wallet.util | ||
|
||
import ch.qos.logback.classic.spi.ILoggingEvent | ||
import ch.qos.logback.core.filter.Filter | ||
import ch.qos.logback.core.spi.FilterReply | ||
|
||
class LogMarkerFilter(acceptedMarkers: List<String>) : Filter<ILoggingEvent?>() { | ||
|
||
constructor() : this(listOf()) | ||
|
||
private val acceptedMarkers = arrayListOf<String>() | ||
|
||
init { | ||
this.acceptedMarkers.addAll(acceptedMarkers) | ||
} | ||
|
||
fun addAcceptedMarker(marker: String) { | ||
acceptedMarkers.add(marker) | ||
} | ||
override fun decide(event: ILoggingEvent?): FilterReply { | ||
val marker = event?.markers?.get(0) ?: return FilterReply.ACCEPT | ||
|
||
return if (acceptedMarkers.contains(marker.name)) { | ||
FilterReply.ACCEPT | ||
} else { | ||
FilterReply.DENY | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will ignore all log entries that are marked because nothing is supplied to the constructor. Later we may enable some markers in debug builds.