I have spent some time now figuring out a useful design for both
issue-#153 and this issue-#158.
Given the requirement of issue-#153 (Console I/O for application programmer)
it is clear that a high level Console module is required that is different from my
Console module introduced for (Kernel) logging.
On the other side, there is common low-level code between both issues and
in this case a separation of the low-level console interface and the high level console
API is quite helpful.
The logging feature is not intended to be a stable, official part of the API, so
it may well be moved into Host, where also the low-level interface for
issue-#153 has been proposed to be implemented.
Host modules have a private interface and are subject to change.
This fits with the 'private' nature of the console logging features.
My proposal merges the low-level part of issue-#153 with the logging feature
into one common module HostConsole. It is still very small, below 2KB code size.
If this module is ported to another platform, it is left to the implementation
if it chooses to support the logging feature or not or it may change the
logging features to whatever the implementation needs.
This is part of the private HostConsole interface.
The only part that is required to be ported is the interface to console I/O as
required for issue-#153.
The main change over the proposal in issue-#153 is that my proposal
does not implement a Console hook but requires that Console imports HostConsole directly.
I have considered also the alternative of decoupling the logging feature from HostConsole
but it either leads to undesired redundancy or undesired dependency.
I also didn't find a good name and a good place for it.
The merged approach is the best compromise I could find so far.
The diffs are here:
https://redmine.blackboxframework.org/p ... 0d2224c0fc.
- Josef