OSDN Git Service

不要となっていたプロパティを削除
[kcd/KCD.git] / KCD / JSONViewCommand.swift
index 6e2cd35..3248c75 100644 (file)
@@ -10,40 +10,60 @@ import Cocoa
 
 #if ENABLE_JSON_LOG
 
-class JSONViewCommand: JSONCommand {
+final class JSONViewCommand: JSONCommand {
+    
     let jsonTree: [JSONNode]?
     let parameterList: [Any]
     let recieveDate: Date?
     let command: JSONCommand
     
     init(apiResponse: APIResponse, command: JSONCommand) {
+        
         self.recieveDate = Date()
-        self.parameterList = apiResponse.argumentArray
+        self.parameterList = apiResponse
+            .parameter
+            .map { ["key": $0, "value": $1] }
         self.jsonTree = JSONNode
-            .nodeWithJSON(apiResponse.json as AnyObject?)
+            .nodeWithJSON(apiResponse.json)
             .map { [$0] }
         self.command = command
+        
         super.init(apiResponse: apiResponse)
     }
     
     required init(apiResponse: APIResponse) {
+        
         fatalError("use init(apiResponse:command:)")
     }
     
     override func execute() {
+        
         do {
+            
             try command.execute()
-        }
-        catch {
+            
+        } catch {
+            
             print("JSONTracker Cought Exception -> \(error)")
         }
         
-        guard let _ = jsonTree else { return print("jsonTree is nil.") }
-        guard let _ = recieveDate else { return print("recieveDate is nil.") }
+        guard let _ = jsonTree else {
+            
+            Logger.shared.log("jsonTree is nil.")
+            
+            return
+        }
+        guard let _ = recieveDate else {
+            
+            Logger.shared.log("recieveDate is nil.")
+            
+            return
+        }
         
         DispatchQueue.main.async {
+            
             let commands: [String: Any] = [
-                "api": self.api,
+                "api": self.api.debugDescription,
                 "argument": self.parameterList,
                 "json": self.jsonTree ?? [],
                 "recieveDate": self.recieveDate ?? Date(),