Class: Smplkit::Logging::Adapters::Base
- Inherits:
-
Object
- Object
- Smplkit::Logging::Adapters::Base
- Defined in:
- lib/smplkit/logging/adapters/base.rb
Overview
Contract for pluggable logging framework integration.
Adapters bridge the smplkit logging runtime to a specific logging framework (e.g., stdlib Logger, semantic_logger). Implement this interface to add support for a new logging framework.
Direct Known Subclasses
Instance Method Summary collapse
-
#apply_level(_logger_name, _level) ⇒ Object
Set the level on a specific logger.
-
#discover ⇒ Object
Scan the runtime for existing loggers.
-
#install_hook ⇒ Object
Install continuous discovery hook.
-
#name ⇒ Object
Human-readable adapter name for diagnostics (e.g., “stdlib-logger”).
-
#uninstall_hook ⇒ Object
Remove the hook installed by
install_hook.
Instance Method Details
#apply_level(_logger_name, _level) ⇒ Object
Set the level on a specific logger.
level is a Smplkit::LogLevel instance; the adapter converts to its framework’s native level representation.
36 37 38 |
# File 'lib/smplkit/logging/adapters/base.rb', line 36 def apply_level(_logger_name, _level) raise NotImplementedError end |
#discover ⇒ Object
Scan the runtime for existing loggers.
Returns an Array of triples [logger_name, explicit_level_or_nil, effective_level] where the levels are Smplkit::LogLevel instances.
- +explicit_level_or_nil+: the level the logger was explicitly
set to, or +nil+ if it inherits from parent / framework default.
- +effective_level+: the resolved level the framework uses for
this logger, accounting for inheritance. Always non-nil.
28 29 30 |
# File 'lib/smplkit/logging/adapters/base.rb', line 28 def discover raise NotImplementedError end |
#install_hook ⇒ Object
Install continuous discovery hook.
The block is invoked with (logger_name, explicit_level_or_nil, effective_level) whenever a new logger is created in the framework.
May be a no-op if the framework doesn’t support creation interception.
48 49 50 |
# File 'lib/smplkit/logging/adapters/base.rb', line 48 def install_hook(&) raise NotImplementedError end |
#name ⇒ Object
Human-readable adapter name for diagnostics (e.g., “stdlib-logger”).
14 15 16 |
# File 'lib/smplkit/logging/adapters/base.rb', line 14 def name raise NotImplementedError end |
#uninstall_hook ⇒ Object
Remove the hook installed by install_hook. Called on client.logging.close.
54 55 56 |
# File 'lib/smplkit/logging/adapters/base.rb', line 54 def uninstall_hook raise NotImplementedError end |