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

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/logging/adapters/base.rb,
sig/smplkit/logging.rbs

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) ⇒ void

This method returns an undefined value.

Set the level on a specific logger.

level is a Smplkit::LogLevel instance; the adapter converts to its framework's native level representation.

Parameters:

Raises:

  • (NotImplementedError)


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

def apply_level(_logger_name, _level)
  raise NotImplementedError
end

#discoverArray[[String, Smplkit::LogLevel?, Smplkit::LogLevel]]

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.

Returns:

Raises:

  • (NotImplementedError)


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

def discover
  raise NotImplementedError
end

#install_hook {|arg0, arg1, arg2| ... } ⇒ void

This method returns an undefined value.

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.

Yields:

Yield Parameters:

Yield Returns:

  • (void)

Raises:

  • (NotImplementedError)


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

def install_hook(&)
  raise NotImplementedError
end

#nameString

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

Returns:

  • (String)

Raises:

  • (NotImplementedError)


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

def name
  raise NotImplementedError
end

#uninstall_hookvoid

This method returns an undefined value.

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