Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Commit

Permalink
Added LogManager using XCGLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Rupérez committed Nov 16, 2017
1 parent 5529e23 commit 062b827
Show file tree
Hide file tree
Showing 82 changed files with 7,804 additions and 1,190 deletions.
49 changes: 41 additions & 8 deletions Archit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
810963E51FB0C42E00B35959 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810963E41FB0C42E00B35959 /* AppDelegate.swift */; };
810963F81FB0C42E00B35959 /* ArchitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810963F71FB0C42E00B35959 /* ArchitTests.swift */; };
810964031FB0C42E00B35959 /* ArchitUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810964021FB0C42E00B35959 /* ArchitUITests.swift */; };
817ED3511FBDE6D90066A679 /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817ED3501FBDE6D90066A679 /* LogManager.swift */; };
817ED3541FBDE7BE0066A679 /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817ED3501FBDE6D90066A679 /* LogManager.swift */; };
817ED3551FBDE7C00066A679 /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817ED3501FBDE6D90066A679 /* LogManager.swift */; };
8374FD19ACE27BF2EEF1BADF /* Pods_Domain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5070463760B7BEFCBFA8995E /* Pods_Domain.framework */; };
9AC00EF4802746D651A3FFE3 /* Pods_CoreTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B55B0227AAC528CF431AFE3 /* Pods_CoreTests.framework */; };
A4D041333F586D156E01B44E /* Pods_Archit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51036FE5FB812710D2B3A0F7 /* Pods_Archit.framework */; };
Expand Down Expand Up @@ -193,6 +196,7 @@
810963FE1FB0C42E00B35959 /* ArchitUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ArchitUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
810964021FB0C42E00B35959 /* ArchitUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchitUITests.swift; sourceTree = "<group>"; };
810964041FB0C42E00B35959 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
817ED3501FBDE6D90066A679 /* LogManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LogManager.swift; path = Source/Managers/LogManager.swift; sourceTree = "<group>"; };
9E13B6F1A1B652AB4AD62B18 /* Pods-Domain.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Domain.release.xcconfig"; path = "Pods/Target Support Files/Pods-Domain/Pods-Domain.release.xcconfig"; sourceTree = "<group>"; };
A73079477914B6D127E59CB7 /* Pods_DomainTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DomainTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
AE55A12BF45485A5033F2DAC /* Pods_ArchitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ArchitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -467,6 +471,7 @@
isa = PBXGroup;
children = (
810963DB1FB0C42E00B35959 /* AppManager.swift */,
817ED3501FBDE6D90066A679 /* LogManager.swift */,
);
name = Managers;
sourceTree = "<group>";
Expand Down Expand Up @@ -954,10 +959,14 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-CoreTests/Pods-CoreTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
"${BUILT_PRODUCTS_DIR}/NetClient/Net.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjcExceptionBridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XCGLogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Net.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1019,14 +1028,18 @@
"${SRCROOT}/Pods/Target Support Files/Pods-Archit/Pods-Archit-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Kingfisher/Kingfisher.framework",
"${BUILT_PRODUCTS_DIR}/Kommander/Kommander.framework",
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
"${BUILT_PRODUCTS_DIR}/Reusable/Reusable.framework",
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
"${BUILT_PRODUCTS_DIR}/NetClient/Net.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kingfisher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kommander.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjcExceptionBridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reusable.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XCGLogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Net.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1109,9 +1122,14 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-DomainTests/Pods-DomainTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjcExceptionBridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XCGLogger.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -1168,13 +1186,13 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ArchitTests/Pods-ArchitTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Kommander/Kommander.framework",
"${BUILT_PRODUCTS_DIR}/NetClient/Net.framework",
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kommander.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Net.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjcExceptionBridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XCGLogger.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -1275,10 +1293,14 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ArchitUITests/Pods-ArchitUITests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ObjcExceptionBridging/ObjcExceptionBridging.framework",
"${BUILT_PRODUCTS_DIR}/XCGLogger/XCGLogger.framework",
"${BUILT_PRODUCTS_DIR}/Cucumberish/Cucumberish.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjcExceptionBridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XCGLogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cucumberish.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -1293,6 +1315,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
817ED3541FBDE7BE0066A679 /* LogManager.swift in Sources */,
D5FF818E1FB8AFD600EAC050 /* NetworkServiceConstants.swift in Sources */,
D582F4581FB61C56002BDB91 /* FilmsNetworkTransformer.swift in Sources */,
D582F4491FB38CF1002BDB91 /* NetworkService.swift in Sources */,
Expand Down Expand Up @@ -1324,6 +1347,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
817ED3551FBDE7C00066A679 /* LogManager.swift in Sources */,
D582F4601FB62207002BDB91 /* Film.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -1342,6 +1366,7 @@
files = (
D582F4311FB2273A002BDB91 /* FilmsViewController.swift in Sources */,
810963E51FB0C42E00B35959 /* AppDelegate.swift in Sources */,
817ED3511FBDE6D90066A679 /* LogManager.swift in Sources */,
D582F4321FB2273A002BDB91 /* FilmsController.swift in Sources */,
810963DC1FB0C42E00B35959 /* AppManager.swift in Sources */,
D582F4341FB22761002BDB91 /* UITableView+Reusable.swift in Sources */,
Expand Down Expand Up @@ -1452,10 +1477,11 @@
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3VW789WSMP;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1465,6 +1491,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.intelygenz.Archit.Core;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
Expand All @@ -1485,10 +1512,11 @@
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3VW789WSMP;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1498,6 +1526,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.intelygenz.Archit.Core;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -1565,10 +1594,11 @@
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3VW789WSMP;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1578,6 +1608,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.intelygenz.Archit.Domain;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
Expand All @@ -1598,10 +1629,11 @@
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3VW789WSMP;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1611,6 +1643,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.intelygenz.Archit.Domain;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
28 changes: 28 additions & 0 deletions Archit/Source/Managers/LogManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// LogManager.swift
// Created by Alex Rupérez on 16/11/17.
// Copyright © 2017 Intelygenz. All rights reserved.

import XCGLogger

let log: XCGLogger = {
let log = XCGLogger(identifier: "advancedLogger", includeDefaultDestinations: false)
log.levelDescriptions[.verbose] = "💜"
log.levelDescriptions[.debug] = "💚"
log.levelDescriptions[.info] = "💙"
log.levelDescriptions[.warning] = "💛"
log.levelDescriptions[.error] = "❤️"
log.levelDescriptions[.severe] = "🖤"

let consoleDestination = ConsoleDestination(identifier: "advancedLogger.consoleDestination")
#if DEBUG
consoleDestination.outputLevel = .debug
#else
consoleDestination.outputLevel = .severe
#endif
consoleDestination.showFunctionName = false
consoleDestination.showFileName = false
consoleDestination.showLineNumber = false
log.add(destination: consoleDestination)

return log
}()
14 changes: 13 additions & 1 deletion Core/Tasks/ServiceTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ open class ServiceTask: ServiceTaskProtocol {
private static let net: Net = {
let net = NetURLSession()
net.addRequestInterceptor { requestBuilder in
return requestBuilder.addURLParameter(NetworkServiceConstants.Parameters.key, value: NetworkServiceConstants.Values.key)
requestBuilder.addURLParameter(NetworkServiceConstants.Parameters.key, value: NetworkServiceConstants.Values.key)
.addURLParameter(NetworkServiceConstants.Parameters.format, value: NetworkServiceConstants.Values.Format.json.rawValue)
.addURLParameter(NetworkServiceConstants.Parameters.version, value: NetworkServiceConstants.Values.version)
log.debug(requestBuilder.build().debugDescription)
return requestBuilder
}
net.addResponseInterceptor { responseBuilder in
let response = responseBuilder.build()
log.debug(response.debugDescription)
do {
if let responseObject: [AnyHashable: Any] = try response.object() {
log.verbose(responseObject)
}
} catch {}
return responseBuilder
}
return net
}()
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use_frameworks!
inhibit_all_warnings!

pod 'SwiftLint'
pod 'XCGLogger'

target 'Archit' do

Expand Down
12 changes: 11 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ PODS:
- NetClient/Core (0.3.5)
- NetClient/URLSession (0.3.5):
- NetClient/Core
- ObjcExceptionBridging (1.0.1):
- ObjcExceptionBridging/ObjcExceptionBridging (= 1.0.1)
- ObjcExceptionBridging/ObjcExceptionBridging (1.0.1)
- Reusable (4.0.0):
- Reusable/Storyboard (= 4.0.0)
- Reusable/View (= 4.0.0)
- Reusable/Storyboard (4.0.0)
- Reusable/View (4.0.0)
- SwiftLint (0.24.0)
- XCGLogger (6.0.1):
- XCGLogger/Core (= 6.0.1)
- XCGLogger/Core (6.0.1):
- ObjcExceptionBridging

DEPENDENCIES:
- Cucumberish
Expand All @@ -22,15 +29,18 @@ DEPENDENCIES:
- NetClient
- Reusable
- SwiftLint
- XCGLogger

SPEC CHECKSUMS:
Cucumberish: 76f542be7b62b1a01ebc6f968be3e002f9403931
Kingfisher: 9ee7e788d8ba07c3f21ce0d43f33cec310a4f781
Kommander: 34bf09d910308fbfd584234896e6e25931b752ff
NetClient: 99cbb60c94c195666fcf723213deff4213f198a7
ObjcExceptionBridging: c30e00eb3700467e695faeea30e26e18bd445001
Reusable: 98e5fff1e0e2e00872199699b276dde08ee56c07
SwiftLint: a014c92b4664e8b13f380f8640a51bb1733778ba
XCGLogger: b4ca980580108cfeaf221afe158f5d89c1be22e0

PODFILE CHECKSUM: 76fd68a25130619b340a1fb7194b6a4f7049924c
PODFILE CHECKSUM: 6e863f7f984be258f0a4db40f1efedf01540a387

COCOAPODS: 1.3.1
12 changes: 11 additions & 1 deletion Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Pods/ObjcExceptionBridging/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 062b827

Please sign in to comment.