Caps-iOS/CapCollector/Logger.swift
2020-05-16 11:21:55 +02:00

45 lines
817 B
Swift

//
// Logger.swift
// CapFinder
//
// Created by User on 11.04.18.
// Copyright © 2018 User. All rights reserved.
//
import Foundation
protocol Logger {
}
extension Logger {
static var logToken: String {
"[" + String(describing: self) + "] "
}
func error(_ message: String) {
Self.addToFile(Self.logToken + "ERROR: " + message)
}
func log(_ message: String) {
Self.addToFile(Self.logToken + message)
}
static func error(_ message: String) {
addToFile(logToken + "ERROR: " + message)
}
static func log(_ message: String) {
addToFile(logToken + message)
}
private static func addToFile(_ message: String) {
logFile += "\n" + message
print(message)
}
}
private(set) var logFile: String = ""