A (Obj)C(++) logging backend for SwiftLog for logging in mixed ObjC/C/C++/Swift targets.
Apple's SwiftLog is simple and easy to use for logging in Swift source code. For mixed ObjC/C/C++/Swift targets, it would be better if we had a common logging format and engine that is based on SwiftLog for consistency.
In (Obj)C(++) source files,import the header as shown below.
#import "SwiftLog.h"
// configure log object
SwiftLogger* log = initLogger(@"label", TRUE);
// Start logging
info_log(log,@"This is a sample log");
This project has Apple's SwiftLog as dependency. This project can be used as a single point of logging for all the mixed source files in your project.
This project by default emits a static library containing Apple's SwiftLog plus the (Obj)C(++) shim.
This project can be configured in following ways as well:
- A dynamic target can be added. This includes SwiftLog for Swift and ObjC/C/C++ log backend.
- If Apple's SwiftLog is already present in your project then: Include the below files in to your project. -- swift_log_objc.swift -- SwiftLog.h -- SwiftLog.m
- Further other suitable targets can also be added to this project.
Swift Package Manager configured for this project throwed "mixed-source" error. This needs analysis and until then i felt this static/dynamic library target would be suitable.
- Investigate if this project can have SPM
- Analyze performace for this front end
Feel free to contribute to this project.
MIT
[Nikhil] (https://twitter.com/nikhil38036647)