Class: Smplkit::Logging::Adapters::Base

Inherits:
Object
  • Object
show all
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

SemanticLoggerAdapter, StdlibLoggerAdapter

Instance Method Summary collapse

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.

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/smplkit/logging/adapters/base.rb', line 36

def apply_level(_logger_name, _level)
  raise NotImplementedError
end

#discoverObject

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.

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/smplkit/logging/adapters/base.rb', line 28

def discover
  raise NotImplementedError
end

#install_hookObject

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.

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/smplkit/logging/adapters/base.rb', line 48

def install_hook(&)
  raise NotImplementedError
end

#nameObject

Human-readable adapter name for diagnostics (e.g., “stdlib-logger”).

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/smplkit/logging/adapters/base.rb', line 14

def name
  raise NotImplementedError
end

#uninstall_hookObject

Remove the hook installed by install_hook. Called on client.logging.close.

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/smplkit/logging/adapters/base.rb', line 54

def uninstall_hook
  raise NotImplementedError
end