Home > OS >  Stack Trace Log in Swift
Stack Trace Log in Swift

Time:01-20

I Build a Swift Logger class that will log the file name, function name with parameters and line number as well.

But It requires me every time to write Logger.Log() for every thing I need to log, But I want to not write down anymore, I want for every method pushed to the stack Trace It logged automatically, and If I want to log with custom message or data I can call the Log method again.

Is this possible to do?

CodePudding user response:

Is this possible to do?

No. Your logger won't log automatically. There is no such thing in Swift as "do this every time an any method is called."

(Also, be careful with how you name things; Swift already has a Logger.log command.)

  • Related