mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Expose the log level in developer settings
This commit is contained in:
committed by
Stefan Ceriu
parent
beeb5fc83c
commit
a19f5a4186
@@ -42,7 +42,7 @@ enum MXLog {
|
||||
private static var target: String!
|
||||
|
||||
static func configure(target: String? = nil,
|
||||
logLevel: TracingConfiguration.LogLevel? = nil,
|
||||
logLevel: TracingConfiguration.LogLevel,
|
||||
redirectToFiles: Bool = Constants.redirectToFiles,
|
||||
maxLogFileCount: UInt = Constants.maxLogFileCount,
|
||||
logFileSizeLimit: UInt = Constants.logFilesSizeLimit) {
|
||||
@@ -58,15 +58,7 @@ enum MXLog {
|
||||
return
|
||||
}
|
||||
|
||||
if let logLevel {
|
||||
setupTracing(configuration: .custom(logLevel: logLevel))
|
||||
} else {
|
||||
#if DEBUG
|
||||
setupTracing(configuration: .debug)
|
||||
#else
|
||||
setupTracing(configuration: .release)
|
||||
#endif
|
||||
}
|
||||
setupTracing(configuration: .custom(logLevel: logLevel))
|
||||
|
||||
if let target {
|
||||
self.target = target
|
||||
|
||||
@@ -21,10 +21,6 @@ import MatrixRustSDK
|
||||
// We can filter by level, crate and even file. See more details here:
|
||||
// https://docs.rs/tracing-subscriber/0.2.7/tracing_subscriber/filter/struct.EnvFilter.html#examples
|
||||
struct TracingConfiguration {
|
||||
static var release = TracingConfiguration(overrides: [.common: .info])
|
||||
|
||||
static var debug = TracingConfiguration(overrides: [.common: .info])
|
||||
|
||||
/// Configure tracing with certain overrides in place
|
||||
/// - Parameter overrides: the desired overrides
|
||||
/// - Returns: a custom tracing configuration
|
||||
@@ -43,7 +39,7 @@ struct TracingConfiguration {
|
||||
return TracingConfiguration(overrides: overrides)
|
||||
}
|
||||
|
||||
enum LogLevel: String { case error, warn, info, debug, trace }
|
||||
enum LogLevel: String, Codable, CaseIterable { case error, warn, info, debug, trace }
|
||||
|
||||
enum Target: String {
|
||||
case common = ""
|
||||
@@ -59,11 +55,11 @@ struct TracingConfiguration {
|
||||
|
||||
static let targets: OrderedDictionary<Target, LogLevel> = [
|
||||
.common: .info,
|
||||
.hyper: .warn,
|
||||
.matrix_sdk_crypto: .debug,
|
||||
.matrix_sdk_http_client: .debug,
|
||||
.matrix_sdk_sliding_sync: .debug,
|
||||
.matrix_sdk_base_sliding_sync: .debug,
|
||||
.hyper: .info,
|
||||
.matrix_sdk_crypto: .info,
|
||||
.matrix_sdk_http_client: .info,
|
||||
.matrix_sdk_sliding_sync: .info,
|
||||
.matrix_sdk_base_sliding_sync: .info,
|
||||
.matrix_sdk_ui_timeline: .info
|
||||
]
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@ import SwiftUI
|
||||
|
||||
struct PillView: View {
|
||||
var body: some View {
|
||||
Button(action: { MXLog.info("TEXT ATTACHMENT TEST") }) {
|
||||
Button {
|
||||
MXLog.info("TEXT ATTACHMENT TEST")
|
||||
} label: {
|
||||
HStack {
|
||||
Image(asset: Asset.Images.launchLogo)
|
||||
.resizable()
|
||||
|
||||
Reference in New Issue
Block a user