Skip to content

Commit

Permalink
added system log to mcuLogObserver
Browse files Browse the repository at this point in the history
  • Loading branch information
NickKibish committed Feb 1, 2022
1 parent e54c3e3 commit d80f5f5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
34 changes: 18 additions & 16 deletions nRF Toolbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@
C39941C227352FC600E7AA33 /* ZephyrPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = C39941C127352FC600E7AA33 /* ZephyrPacket.swift */; };
C39941E6273BCE0500E7AA33 /* nRF_Toolbox_DebugTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C39941E5273BCE0500E7AA33 /* nRF_Toolbox_DebugTests.swift */; };
C3CD27D526B097510026FE67 /* AEXML in Frameworks */ = {isa = PBXBuildFile; productRef = C3CD27D426B097510026FE67 /* AEXML */; };
C3CD27DB26B097AB0026FE67 /* NordicDFU in Frameworks */ = {isa = PBXBuildFile; productRef = C3CD27DA26B097AB0026FE67 /* NordicDFU */; };
C3CD27DE26B098070026FE67 /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = C3CD27DD26B098070026FE67 /* Charts */; };
C3E8C1AC26F21FD0000A3737 /* FilterSwitchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E8C1AB26F21FD0000A3737 /* FilterSwitchView.swift */; };
C3E8C1AE26F21FE4000A3737 /* FilterSwitchView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3E8C1AD26F21FE3000A3737 /* FilterSwitchView.xib */; };
C3EFCAF027A943EE00BFE8C4 /* NordicDFU in Frameworks */ = {isa = PBXBuildFile; productRef = C3EFCAEF27A943EE00BFE8C4 /* NordicDFU */; };
CC7B90D148FC21C73B54BFAB /* NumberFormatter+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7B93FA695799F95D065492 /* NumberFormatter+Ext.swift */; };
CC7B91DDFD7EF39F27FEC85A /* CommandImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7B95845343A3D826B220D5 /* CommandImage.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -584,8 +584,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C3EFCAF027A943EE00BFE8C4 /* NordicDFU in Frameworks */,
522636371C60FFB00054A550 /* libz.tbd in Frameworks */,
C3CD27DB26B097AB0026FE67 /* NordicDFU in Frameworks */,
52BDCB191C3FD31F00E2680F /* Accelerate.framework in Frameworks */,
52BDCBBE1C3FD86900E2680F /* QuartzCore.framework in Frameworks */,
C3CD27D526B097510026FE67 /* AEXML in Frameworks */,
Expand Down Expand Up @@ -1782,10 +1782,10 @@
name = "nRF Toolbox";
packageProductDependencies = (
C3CD27D426B097510026FE67 /* AEXML */,
C3CD27DA26B097AB0026FE67 /* NordicDFU */,
C3CD27DD26B098070026FE67 /* Charts */,
C39941B5273402FA00E7AA33 /* McuManager */,
C39941BB27341AAE00E7AA33 /* ZIPFoundation */,
C3EFCAEF27A943EE00BFE8C4 /* NordicDFU */,
);
productName = "nRF Toolbox";
productReference = 5217F3E21859EE0000F2D5BB /* nRF Toolbox Debug.app */;
Expand All @@ -1805,6 +1805,8 @@
C39941E8273BCE0500E7AA33 /* PBXTargetDependency */,
);
name = "nRF Toolbox DebugTests";
packageProductDependencies = (
);
productName = "nRF Toolbox DebugTests";
productReference = C39941E3273BCE0500E7AA33 /* nRF Toolbox DebugTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand Down Expand Up @@ -1848,10 +1850,10 @@
mainGroup = 5217F3D91859EE0000F2D5BB;
packageReferences = (
C3CD27D326B097510026FE67 /* XCRemoteSwiftPackageReference "AEXML" */,
C3CD27D926B097AB0026FE67 /* XCRemoteSwiftPackageReference "IOS-Pods-DFU-Library" */,
C3CD27DC26B098070026FE67 /* XCRemoteSwiftPackageReference "Charts" */,
C39941B4273402FA00E7AA33 /* XCRemoteSwiftPackageReference "IOS-nRF-Connect-Device-Manager" */,
C39941BA27341AAE00E7AA33 /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
C3EFCAEE27A943EE00BFE8C4 /* XCRemoteSwiftPackageReference "IOS-DFU-Library" */,
);
productRefGroup = 5217F3E31859EE0000F2D5BB /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -2664,20 +2666,20 @@
minimumVersion = 4.6.0;
};
};
C3CD27D926B097AB0026FE67 /* XCRemoteSwiftPackageReference "IOS-Pods-DFU-Library" */ = {
C3CD27DC26B098070026FE67 /* XCRemoteSwiftPackageReference "Charts" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library.git";
repositoryURL = "https://github.com/danielgindi/Charts.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.10.4;
minimumVersion = 4.0.1;
};
};
C3CD27DC26B098070026FE67 /* XCRemoteSwiftPackageReference "Charts" */ = {
C3EFCAEE27A943EE00BFE8C4 /* XCRemoteSwiftPackageReference "IOS-DFU-Library" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/danielgindi/Charts.git";
repositoryURL = "https://github.com/NordicSemiconductor/IOS-DFU-Library.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.0.1;
branch = master;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand All @@ -2698,16 +2700,16 @@
package = C3CD27D326B097510026FE67 /* XCRemoteSwiftPackageReference "AEXML" */;
productName = AEXML;
};
C3CD27DA26B097AB0026FE67 /* NordicDFU */ = {
isa = XCSwiftPackageProductDependency;
package = C3CD27D926B097AB0026FE67 /* XCRemoteSwiftPackageReference "IOS-Pods-DFU-Library" */;
productName = NordicDFU;
};
C3CD27DD26B098070026FE67 /* Charts */ = {
isa = XCSwiftPackageProductDependency;
package = C3CD27DC26B098070026FE67 /* XCRemoteSwiftPackageReference "Charts" */;
productName = Charts;
};
C3EFCAEF27A943EE00BFE8C4 /* NordicDFU */ = {
isa = XCSwiftPackageProductDependency;
package = C3EFCAEE27A943EE00BFE8C4 /* XCRemoteSwiftPackageReference "IOS-DFU-Library" */;
productName = NordicDFU;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 5217F3DA1859EE0000F2D5BB /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,21 @@ class McuMgrLogObserver: LogObserver, McuMgrLogDelegate {
var shouldLog: Bool = true

func log(_ msg: String, ofCategory category: McuMgrLogCategory, atLevel level: McuMgrLogLevel) {
// guard shouldLog else { return }
SystemLog(category: .update, type: toSystemLogLevel(level: level)).log(message: msg)

logWith(level.level, message: msg)
}

private func toSystemLogLevel(level: McuMgrLogLevel) -> LogType {
switch (level) {
case .error: return .error
case .application: return .application
case .debug: return .debug
case .info: return .info
case .verbose: return .verbose
case .warning: return .warning
}
}


}
1 change: 1 addition & 0 deletions nRF Toolbox/Utilities/SystemLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ extension LogCategory {
static let ble = LogCategory(rawValue: "ble")!
static let util = LogCategory(rawValue: "util")!
static let app = LogCategory(rawValue: "application")!
static let update = LogCategory(rawValue: "update")!
}

struct SystemLog {
Expand Down

0 comments on commit d80f5f5

Please sign in to comment.