Kernel logging is inherently global: KernelLogger is a process-wide
singleton, so every connection receives every log entry and shares the
minimum level. Multiple btck_LoggingConnection handles give the false
impression of independent loggers.
Limit btck_global_logging_connection_create to a single connection, so
that the globalness is expressed in that one function and the rest of
the interface can operate on the connection handle.
A single connection also makes it straightforward to invoke the callback without holding the logger's mutex. Holding it serializes all logging threads on user code, and deadlocks if anything on the callback's thread logs, e.g. a garbage collector running finalizers that destroy kernel objects.
Behaviour changes for consumers:
btck_logging_connection_createis renamed tobtck_global_logging_connection_create, and fails if a connection already exists.btck_logging_set_min_levelbecomesbtck_logging_connection_set_min_level, and each new connection starts atInfo.- The "Logger connected."
Debugentry is removed, since it can no longer be delivered. - The callback can be invoked from multiple threads at the same time, so it must be thread-safe. Destroying the connection still waits for running invocations to return.