Przeglądaj źródła

change log format

huzhiqiang 3 lat temu
rodzic
commit
02485cc767

+ 8 - 7
BFFramework/Classes/PQGPUImage/akfilters/PQMovieInput.swift

@@ -195,8 +195,8 @@ public class PQMovieInput: ImageSource {
         self.videoInputStatusObserver?.invalidate()
         self.audioInputStatusObserver?.invalidate()
         self.avPlayerTimeObserver?.invalidate()
-        
-        BFLog(message: "movieinput 销毁")
+
+        BFLog(1, message: "movieinput release")
     }
 
     // MARK: -
@@ -426,7 +426,7 @@ public class PQMovieInput: ImageSource {
             FilterLog(message: "assetReader init \(assetReader)  asset url is \(asset)")
             if audioMix == nil {
                 if let audioTrack = asset.tracks(withMediaType: .audio).first, let _ = audioEncodingTarget {
-                    FilterLog(message: "audioTrack start \(audioTrack.timeRange.start) \(audioTrack.timeRange.duration.value)")
+                    BFLog(1, message: "audioTrack start \(audioTrack.timeRange.start) \(audioTrack.timeRange.duration.value)")
 
                     let readerAudioTrackOutput = AVAssetReaderTrackOutput(track: audioTrack, outputSettings: audioSettings)
                     readerAudioTrackOutput.alwaysCopiesSampleData = false
@@ -471,7 +471,7 @@ public class PQMovieInput: ImageSource {
             
     
             let prgressValue = (currTime - start) / (duration - start)
-            FilterLog(message: "\(mIsExport) movinput 当前时间 is \(currTime) 当前进度:\(prgressValue)")
+//            BFLog(1, message: "\(mIsExport) movinput 当前时间 is \(currTime) curr当前进度:\(prgressValue)")
             progress?(currTime, duration, prgressValue)
 
             sharedImageProcessingContext.runOperationSynchronously {
@@ -498,6 +498,7 @@ public class PQMovieInput: ImageSource {
          case cancelled = 4
          */
         FilterLog(message: "音频解码状态\(assetReader.status.rawValue)")
+        BFLog(1, message:  "音频解码状态\(assetReader.status.rawValue)")
         
         autoreleasepool {
             guard let sampleBuffer = audioTrackOutput.copyNextSampleBuffer(),CMSampleBufferIsValid(sampleBuffer) else {
@@ -700,7 +701,7 @@ extension PQMovieInput {
                 let range = strongSelf.musicPlayRanges?[strongSelf.indexRage]
                 playerItem.forwardPlaybackEndTime = range!.end
                 playerItem.reversePlaybackEndTime = range!.start
-//                HHZPrint("curr: start ********************\(CMTimeGetSeconds(range.start)) - \(playerItem.reversePlaybackEndTime) - \(playerItem.forwardPlaybackEndTime)")
+//                BFLog(1, message: "curr: start ********************\(CMTimeGetSeconds(range.start)) - \(playerItem.reversePlaybackEndTime) - \(playerItem.forwardPlaybackEndTime)")
                 strongSelf.avPlayer!.seek(to: playerItem.reversePlaybackEndTime) { isSuccess in
                     playerItem.seek(to: playerItem.reversePlaybackEndTime) { isSuccess in
                         strongSelf.avPlayer!.play()
@@ -712,8 +713,8 @@ extension PQMovieInput {
         }
         
 //        avPlayerTimeObserver = avPlayer!.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 4), queue: DispatchQueue.global()) {[weak self] time in
-            // 进度监控
-//            HHZPrint("index:\(self?.indexRage), curr:\(CMTimeGetSeconds(time))")
+//             进度监控
+//            BFLog(1, message: "cont:\(CMTimeGetSeconds(time) - CMTimeGetSeconds((self?.musicPlayRanges?.first!.start)!)), curr:\(CMTimeGetSeconds(time))")
 //        } as? NSKeyValueObservation
     }
     

+ 2 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -1254,8 +1254,7 @@ extension PQStuckPointEditerController {
 
                                         lastOutTime = deepCopySticker?.out ?? 0
                                     }
-
-                                    BFLog(message: "测试人员创建 sticker  crilp is in 视频 \(String(format: "%.6f", deepCopySticker?.model_in ?? 0))  out  \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 视频素材原时长\(CMTimeGetSeconds(asset.duration)) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)")
+                                    BFLog(1, message: "测试人员创建 sticker  crilp is in 视频 \(String(format: "%.6f", deepCopySticker?.model_in ?? 0))  out  \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 视频素材原时长\(CMTimeGetSeconds(asset.duration)) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)")
 
                                     if deepCopySticker != nil {
                                         stickers.append(deepCopySticker!)
@@ -1271,7 +1270,7 @@ extension PQStuckPointEditerController {
                                 sticker.timelineIn = Float64(String(format: "%.6f",finallyStuckPoints[stickers.count])) ?? 0.0
                                 sticker.timelineOut = Float64(String(format: "%.6f",finallyStuckPoints[stickers.count + 1])) ?? 0.0
                                 stickers.append(sticker)
-                                BFLog(message: "测试人员创建 sticker  crilp is in 图片 \(String(format: "%.6f", sticker.model_in))  out  \(String(format: "%.6f", sticker.out)) ,分段素材时长:\(String(format: "%.6f", (sticker.out) - (sticker.model_in))) ,分段显示时长:\(String(format: "%.6f", (sticker.timelineOut) - (sticker.timelineIn))),   timelineIN: \(String(format: "%.6f", sticker.timelineIn)) timelineOUT:\(String(format: "%.6f", sticker.timelineOut)) speedRate:\(sticker.speedRate)")
+                                BFLog(1, message: "测试人员创建 sticker  crilp is in 图片 \(String(format: "%.6f", sticker.model_in))  out  \(String(format: "%.6f", sticker.out)) ,分段素材时长:\(String(format: "%.6f", (sticker.out) - (sticker.model_in))) ,分段显示时长:\(String(format: "%.6f", (sticker.timelineOut) - (sticker.timelineIn))),   timelineIN: \(String(format: "%.6f", sticker.timelineIn)) timelineOUT:\(String(format: "%.6f", sticker.timelineOut)) speedRate:\(sticker.speedRate)")
                             }
                         }
                     }

+ 2 - 3
BFFramework/Classes/Stuckpoint/View/PQStuckPointCuttingView.swift

@@ -167,7 +167,7 @@ class PQStuckPointCuttingView: UIView {
         
         tatalTimeLabel.text = "\(Float64(stuckPointEndTime - stuckPointStartTime).formatDurationToHMS())"
   
-        BFLog(message: "推荐开始\(stuckPointStartTime) 结束\(stuckPointEndTime) 时长为:\(stuckPointEndTime - stuckPointStartTime)  音乐总时长为:\(videoDuration)")
+        BFLog(1, message: "推荐开始\(stuckPointStartTime) 结束\(stuckPointEndTime) 时长为:\(stuckPointEndTime - stuckPointStartTime)  音乐总时长为:\(videoDuration)")
         backgroundColor = PQBFConfig.shared.styleBackGroundColor
         addSubview(scrollView)
 
@@ -210,8 +210,7 @@ class PQStuckPointCuttingView: UIView {
         }
         scrollView.contentSize = CGSize(width: contentWidth, height: scrollView.frame.height)
         
-//        HHZPrint("框内个数:\(wavSelectCount), 总线条数:\(wavTotalCount), 框宽:\(cropViewWidth)")
-        
+        BFLog(1, message: "框内个数:\(wavSelectCount), 总线条数:\(wavTotalCount), 框宽:\(cropViewWidth)")
         scrollView.subviews.forEach { lable in
             if lable is UILabel && lable.tag != 66 {
                 lable.removeFromSuperview()

+ 4 - 2
BFFramework/Classes/Stuckpoint/ViewModel/PQGPUImagePlayerView.swift

@@ -360,7 +360,9 @@ public class PQGPUImagePlayerView: UIView {
         var composition: AVMutableComposition?
 
         let asset = AVURLAsset(url: url, options: nil)
-        FilterLog(message: "播放器初始化的音频时长\(asset.duration.seconds)  url is \(url),最终使用时长\(originMusicDuration),裁剪范围\(CMTimeGetSeconds(clipAudioRange.start)) 到 \(CMTimeGetSeconds(clipAudioRange.end))")
+//        FilterLog(message: "播放器初始化的音频时长\(asset.duration.seconds)  url is \(url),最终使用时长\(originMusicDuration),裁剪范围\(CMTimeGetSeconds(clipAudioRange.start)) 到 \(CMTimeGetSeconds(clipAudioRange.end))")
+        BFLog(1, message:  "播放器初始化的音频时长\(asset.duration.seconds)  url is \(url),最终使用时长\(originMusicDuration),裁剪范围\(CMTimeGetSeconds(clipAudioRange.start)) 到 \(CMTimeGetSeconds(clipAudioRange.end))")
+
         self.asset = asset
         if (audioMixModel != nil && audioMixModel?.localPath != nil) || (videoStickers != nil && (videoStickers?.count ?? 0) > 0 || originMusicDuration != 0) {
             FilterLog(message: "有参加混音的数据。")
@@ -413,7 +415,7 @@ public class PQGPUImagePlayerView: UIView {
         movie.progress = { [weak self] currTime, duration, prgressValue in
             guard let strongSelf = self else { return }
 
-//            HHZPrint(" movie 进度\(currTime)")
+//            BFLog(1, message: " movie 进度\(currTime)")
             strongSelf.changeFilter(currTime: currTime)
             strongSelf.progress?(currTime, duration, prgressValue)
 

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

@@ -133,17 +133,25 @@ public func kf_imageCacheImage(originUrl: String, completeHandle: @escaping (_ i
 }
 
 /** 打印 */
-public func BFLog<T>(message: T) {
+public func BFLog<T>( _ type : Int = 0, message: T) {
  
-    let logger = NXLogger.shared
-
-    logger.level = .info
-    logger.ouput = .deviceConsoleAndFile
-
-    logger.d(message as? String ?? "")
-    
-    BuglyLog.level(.warn, logs: message as? String)
-    
+    if type == 2 {
+        let logger = NXLogger.shared
+        
+        logger.level = .info
+        logger.ouput = .deviceConsoleAndFile
+        
+        logger.d(message as? String ?? "")
+        
+        BuglyLog.level(.warn, logs: message as? String)
+    }else if type == 1 {
+#if DEBUG
+        let file = (#file as NSString).lastPathComponent;
+        let dateFmt = DateFormatter()
+        dateFmt.dateFormat = "HH:mm:ss:SSS"
+        print("hhz-\(dateFmt.string(from: Date())) \(file):(\(#line))--\(message)");
+#endif
+    }
 //    if PQENVUtil.shared.envMode == .ENVModeTest {
 //     
 //    }else{
@@ -408,7 +416,7 @@ public func getMachineCode() -> String {
         uuid = NSUUID().uuidString
         keychain["machineCode"] = uuid
     }
-    BFLog(message: "正式账号mid:\(uuid)")
+//    BFLog(message: "正式账号mid:\(uuid)")
     return uuid
 }