Files
damus/damus/Util/Log.swift
T
ericholguin 22f2aba969 nwc: Wallet Redesign
This PR redesigns the NWC wallet view. A new view is added to introduce zaps to users. The set up wallet view is simplified, with new and existing wallet setup separated.
This also adds new NWC features such as getBalance and listTransactions allowing users to see their balance and previous transactions made.

Changelog-Added: Added view introducing users to Zaps
Changelog-Added: Added new wallet view with balance and transactions list
Changelog-Changed: Improved integration with Nostr Wallet Connect wallets
Closes: https://github.com/damus-io/damus/issues/2900

Signed-off-by: ericholguin <ericholguin@apache.org>
Co-Authored-By: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2025-03-19 18:00:00 -03:00

65 lines
2.0 KiB
Swift

//
// Log.swift
// damus
//
// Created by William Casarin on 2023-08-02.
//
import Foundation
import os.log
enum LogCategory: String {
case nav
case render
case storage
case networking
case timeline
/// Logs related to Nostr Wallet Connect components
case nwc
case push_notifications
case damus_purple
case image_uploading
case video_coordination
}
/// Damus structured logger
class Log {
static private func logger(for logcat: LogCategory) -> OSLog {
return OSLog(subsystem: "com.jb55.damus", category: logcat.rawValue)
}
/// dumb workaround, swift can't forward C vararsg
static private func log(_ message: StaticString, for log: OSLog, type: OSLogType, _ args: [CVarArg]) {
switch args.count {
case 0:
os_log(message, log: log, type: type)
case 1:
os_log(message, log: log, type: type, args[0])
case 2:
os_log(message, log: log, type: type, args[0], args[1])
case 3:
os_log(message, log: log, type: type, args[0], args[1], args[2])
case 4:
os_log(message, log: log, type: type, args[0], args[1], args[2], args[3])
case 5:
os_log(message, log: log, type: type, args[0], args[1], args[2], args[3], args[4])
default:
os_log("Too many variadic params were sent to the logger so we tossed them!", log: log, type: .error)
os_log(message, log: log, type: type)
}
}
static func info(_ msg: StaticString, for logcat: LogCategory, _ args: CVarArg...) {
Log.log(msg, for: logger(for: logcat), type: OSLogType.info, args)
}
static func debug(_ msg: StaticString, for logcat: LogCategory, _ args: CVarArg...) {
Log.log(msg, for: logger(for: logcat), type: OSLogType.debug, args)
}
static func error(_ msg: StaticString, for logcat: LogCategory, _ args: CVarArg...) {
Log.log(msg, for: logger(for: logcat), type: OSLogType.error, args)
}
}