Just copy the code

// ChLog.swift
// IntelligentGas
//
// Created by jszx-ch on 2021/4/21.
// Copyright © 2021 ch. All rights reserved
//

import Foundation

/// Can quickly locate the specific location of the print
func printLog<T>(_ msg: T,
            file: NSString = #file,
            line: Int = #line,
            fn: String = #function) {#if DEBUG
    let prefix = "\(file.lastPathComponent)_\(line)_\(fn):"
    print(prefix, msg)
    #endif
}
Copy the code

Print result: