6 Commits

Author SHA1 Message Date
Andrew Bettison
81d4e696ca Improve Swift API delegate log outputter
Capture whence information in all Serval logging API entry points.

Introduce the LogLevel enum type to avoid exposing internal C API
details in the Swift API.

Rename Swift API methods and types to use camelCase naming style, to
distinguish it from the C API, which uses under_score naming style.
2018-06-01 17:41:32 +09:30
Andrew Bettison
33518fd286 Add Swift CliContextArray 2018-06-01 17:41:31 +09:30
Andrew Bettison
b6873c73dd Fix the Apple Xcode 9.3 iOS build
The iOS build now produces two frameworks instead of one:
- 'serval_dna' is the C API
- 'ServalDNA' is the Swift API (daemon)

The top-level modulemap file now produces a C API module called
'serval_dna' (renamed the library to libserval_dna.a) so that the Swift
API code can be identical for iOS and non-iOS targets.
2018-06-01 17:41:31 +09:30
Andrew Bettison
14903ca18d Add log outputter for Apple iOS and macOS
On iOS, the log outputter uses Apple's Unified Logging System, but on
Mac OS, the logger uses the older Syslog API so that it will compile on
platforms older than macOS 10.13 High Sierra.
2018-06-01 17:41:31 +09:30
Andrew Bettison
bb5fc482c7 Fix Swift compile error on ARM 64-bit 2018-06-01 17:41:31 +09:30
Andrew Bettison
a79156c4d0 Add Swift daemon API, use in 'servaldswift'
The daemon API is built as a Swift module called ServalDNA.

The new CliContext class allows easy implementation of CLI output using
Swift code.  The new CliContextFile subclass is the obvious first
implementation, equivalent to cli_stdio.c.  The 'servaldswift'
executable now uses CliContextFile to print its CLI output to standard
output.

The new delegated log output support constructs each log line in a
buffer and prints it by calling the delegate's 'print' function at
end-of-line.  The 'servaldswift' executable now provides a log output
delegate in Swift that simply prints to standard error, replacing
log_output_console.o, which is omitted from its link.
2018-03-06 15:29:17 +10:30