Skip to content

Commit d3d9a2b

Browse files
committed
feat: add Logger.trace to log stack trace
1 parent b8ae8a2 commit d3d9a2b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

BeappLogger.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'BeappLogger'
3-
s.version = '0.3.0'
3+
s.version = '0.4.0'
44
s.summary = 'This Pod allows you to centralize the logs of your app, and distribute them wherever you want.'
55

66
s.homepage = 'https://github.com/BeApp/beapp.library.logger.ios.git'

BeappLogger/Classes/Logger.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,9 @@ public class Logger {
133133
let components = filePath.components(separatedBy: "/")
134134
return components.isEmpty ? "" : components.last!.replacingOccurrences(of: ".swift", with: "")
135135
}
136-
136+
137+
/// Log the stack trace (as debug)
138+
public static func trace(file: String = #file, line: Int = #line, funcName: String = #function) {
139+
broadcastMessage("StackTrace\n\(Thread.callStackSymbols.joined(separator: "\n"))", file: file, line: line, funcName: funcName, priority: .debug)
140+
}
137141
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Logger.debug("TEST")
3535
Logger.info("TEST")
3636
Logger.warn("TEST")
3737
Logger.error("TEST")
38+
Logger.trace()
3839
```
3940

4041
### Result

0 commit comments

Comments
 (0)