43 lines
785 B
Swift
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 = ""
|
|
|