Caps-iOS/CapCollector/Logger.swift
2019-04-12 13:45:31 +02:00

43 lines
785 B
Swift

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