mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-05 23:53:08 +00:00
chore: reduce terminal log noise
This commit is contained in:
parent
569607b616
commit
d2e8185d6f
@ -104,13 +104,23 @@ proc libsdsNimMain() {.importc.}
|
||||
# To control when the library has been initialized
|
||||
var initialized: Atomic[bool]
|
||||
|
||||
if defined(android):
|
||||
when defined(android):
|
||||
# Redirect chronicles to Android System logs
|
||||
when compiles(defaultChroniclesStream.outputs[0].writer):
|
||||
defaultChroniclesStream.outputs[0].writer = proc(
|
||||
logLevel: LogLevel, msg: LogOutputStr
|
||||
) {.raises: [].} =
|
||||
echo logLevel, msg
|
||||
else:
|
||||
# For non-android, configure Chronicles with a null writer to suppress logs
|
||||
# or redirect to a proper logging mechanism
|
||||
when compiles(defaultChroniclesStream.outputs[0].writer):
|
||||
defaultChroniclesStream.outputs[0].writer = proc(
|
||||
logLevel: LogLevel, msg: LogOutputStr
|
||||
) {.raises: [].} =
|
||||
# Only log ERROR and FATAL levels to reduce verbosity
|
||||
if logLevel >= LogLevel.ERROR:
|
||||
echo "[nim-sds] ", logLevel, ": ", msg
|
||||
|
||||
proc initializeLibrary() {.exported.} =
|
||||
if not initialized.exchange(true):
|
||||
|
||||
@ -63,7 +63,7 @@ proc process*(
|
||||
let messageBytes = self.message.toSeq()
|
||||
|
||||
let (unwrappedMessage, missingDeps, channelId) = unwrapReceivedMessage(rm[], messageBytes).valueOr:
|
||||
error "UNWRAP_MESSAGE failed", error = error
|
||||
debug "UNWRAP_MESSAGE failed", error = error
|
||||
return err("error processing UNWRAP_MESSAGE request: " & $error)
|
||||
|
||||
let res = SdsUnwrapResponse(message: unwrappedMessage, missingDeps: missingDeps, channelId: channelId)
|
||||
|
||||
@ -55,7 +55,7 @@ proc reviewAckStatus(rm: ReliabilityManager, msg: SdsMessage) {.gcsafe.} =
|
||||
)
|
||||
)
|
||||
else:
|
||||
error "Failed to deserialize bloom filter", error = bfResult.error
|
||||
debug "Failed to deserialize bloom filter", error = bfResult.error
|
||||
rbf = none[RollingBloomFilter]()
|
||||
else:
|
||||
rbf = none[RollingBloomFilter]()
|
||||
@ -106,7 +106,7 @@ proc wrapOutgoingMessage*(
|
||||
|
||||
let bfResult = serializeBloomFilter(channel.bloomFilter.filter)
|
||||
if bfResult.isErr:
|
||||
error "Failed to serialize bloom filter", channelId = channelId
|
||||
debug "Failed to serialize bloom filter", channelId = channelId
|
||||
return err(ReliabilityError.reSerializationError)
|
||||
|
||||
let msg = SdsMessage(
|
||||
@ -230,7 +230,7 @@ proc unwrapReceivedMessage*(
|
||||
|
||||
return ok((msg.content, missingDeps, channelId))
|
||||
except Exception:
|
||||
error "Failed to unwrap message", msg = getCurrentExceptionMsg()
|
||||
debug "Failed to unwrap message", msg = getCurrentExceptionMsg()
|
||||
return err(ReliabilityError.reDeserializationError)
|
||||
|
||||
proc markDependenciesMet*(
|
||||
|
||||
@ -78,7 +78,7 @@ proc clean*(rbf: var RollingBloomFilter) {.gcsafe.} =
|
||||
|
||||
# Initialize new filter
|
||||
var newFilter = initializeBloomFilter(rbf.maxCapacity, rbf.filter.errorRate).valueOr:
|
||||
error "Failed to create new bloom filter", error = $error
|
||||
debug "Failed to create new bloom filter", error = $error
|
||||
return
|
||||
|
||||
# Keep most recent messages up to minCapacity
|
||||
@ -93,7 +93,7 @@ proc clean*(rbf: var RollingBloomFilter) {.gcsafe.} =
|
||||
rbf.messages = newMessages
|
||||
rbf.filter = newFilter
|
||||
except Exception:
|
||||
error "Failed to clean bloom filter", error = getCurrentExceptionMsg()
|
||||
debug "Failed to clean bloom filter", error = getCurrentExceptionMsg()
|
||||
|
||||
proc add*(rbf: var RollingBloomFilter, messageId: SdsMessageID) {.gcsafe.} =
|
||||
## Adds a message ID to the rolling bloom filter.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user