Where is Logfile stored using cocoaLumberjack

前端 未结 9 1027
不知归路
不知归路 2020-12-22 18:07

I am Using cocoaLumberjack logging framework for iOS logging. For storing logs in a file I used this code.

DDFileLogger* fileLogger = [[DDFileLogger alloc] i         


        
9条回答
  •  执念已碎
    2020-12-22 18:32

    I don't know if this might help somebody else... I took the previous answers and passed it to Swift 5. Apart from getting all the paths, it prints the content.

    let logFileLogger = DDFileLogger()
    print(logFileLogger.logFileManager.logsDirectory)
    
    for path in logFileLogger.logFileManager.sortedLogFilePaths {
        do {
            let content = try String(contentsOfFile: path, encoding: .utf8)
            print(content)
        } catch let error as NSError {
            print("Error: \(error.localizedDescription)")
        }
    }
    

提交回复
热议问题