Skip to content

Commit

Permalink
corrected sources path, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Stibane committed Nov 10, 2022
1 parent 3765ac7 commit 8c7b407
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
File renamed without changes.
15 changes: 7 additions & 8 deletions SOURCES/SYMLOG/SymLogC.swift → SOURCES/SymLog/SymLogC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SymLogC {
private static func className() -> String {"\(self)"}
private static var loggedClasses: [String] = [] // names of classes using IDLogC
private static var loggedInstances: [Int] = [] // how many instances of "name" have been allocated
public static var watchedInstance: Int = 0 // set to # of instance you want to catch
public static var watchedInstance: Int = 0 // set to # of instance you want to catch

// returns instance count and symbol#
static func count(_ name: String)-> (Int, Int) {
Expand All @@ -40,7 +40,7 @@ public class SymLogC {
}

let name: String // the class name of the logging object
var symbol: Int // the symbol to use (1..80) or 0 to disable logging
var symbol: Int // the symbol to use (1..80) or 0 to disable logging
let instance: Int // the instance number of this logging object
public var catchDeinit: Bool = false // set true to catch only deinit of instance

Expand All @@ -53,20 +53,19 @@ public class SymLogC {
}
}


public init(_ symbol: Int = -1, // init with 0 to disable logging for this class
public init(_ symbol: Int = -1, // init with 0 to disable logging for this class
funcName: String = #function,
filePath: String = #file,
line: UInt = #line) {
self.name = funcName
let (instance, index) = Self.count(name)
self.instance = instance // incremented instance# from loggedInstances
if symbol > 0 {
self.symbol = symbol // manual override
self.symbol = symbol // manual override
} else if symbol < 0 {
self.symbol = index // automatic, use incremented index
self.symbol = index // automatic, use incremented index
} else {
self.symbol = -index // 0 ==> no logging, but save negative index
self.symbol = -index // 0 ==> no logging, but save negative index
}

self.log("", funcName:"\(Self.className())()", filePath:filePath, line:line)
Expand All @@ -79,7 +78,7 @@ public class SymLogC {
if self.instance == Self.watchedInstance {
catchDeinit = true // set a breakpoint here to catch watched instance
}
if self.symbol > 0 { // don't log if symbol <= 0
if self.symbol > 0 { // don't log if symbol <= 0
let classFuncName = "\(self.name)#\(self.instance) \(funcName)"
symLog(message, self.symbol, funcName: classFuncName, filePath: filePath, line: line)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SwiftUI
public class SymLogV: SymLogC {
private static var indent: Int = 0

public override init(_ symbol: Int = -1, // init with 0 to disable logging for this class
public override init(_ symbol: Int = -1, // init with 0 to disable logging for this class
funcName: String = #function,
filePath: String = #file,
line: UInt = #line) {
Expand Down

0 comments on commit 8c7b407

Please sign in to comment.