Parcourir la source

修改日志输出方法

jsonwang il y a 3 ans
Parent
commit
3044a08688
1 fichiers modifiés avec 11 ajouts et 6 suppressions
  1. 11 6
      BFFramework/Classes/Utils/PQCommonMethodUtil.swift

+ 11 - 6
BFFramework/Classes/Utils/PQCommonMethodUtil.swift

@@ -133,15 +133,20 @@ public func kf_imageCacheImage(originUrl: String, completeHandle: @escaping (_ i
 }
 
 /** 打印 */
-public func BFLog<T>( _ type : Int = 9, _ file:String = #file, _ line:Int = #line, message: T) {
+public func BFLog<T>( _ type : Int = 0, _ file:String = #file, _ line:Int = #line, message: T) {
+    
+    
+    let file = (file as NSString).lastPathComponent;
+    let dateFmt = DateFormatter()
+    dateFmt.dateFormat = "HH:mm:ss:SSSS"
+    let msg = "\(dateFmt.string(from: Date())) \(file):(\(line))--\(message)"
+    
 #if DEBUG
     if type == 0 {
-        print(message)
+
+        BuglyLog.level(.warn, logs: msg)
     }else if type == 3 {
-        let file = (file as NSString).lastPathComponent;
-        let dateFmt = DateFormatter()
-        dateFmt.dateFormat = "HH:mm:ss:SSSS"
-        print("hhz-\(dateFmt.string(from: Date())) \(file):(\(line))--\(message)");
+        print("hhz-\(msg)");
     }
 #endif
 //    if PQENVUtil.shared.envMode == .ENVModeTest {