Skip to main content

easyfabric.policies

logging

Optional

FabricError

FabricSourceUnchangedError

ViolationPolicy Objects

class ViolationPolicy()

Decides the action to take when a data or configuration violation is encountered. Actions: 'stop' (raise exception), 'warn' (log warning), 'skip' (log info and stop processing for that item).

STOP

WARN

SKIP

__init__

def __init__(action: str = WARN)

handle

def handle(message: str,
exception_cls: Optional[type[FabricError]] = None,
**kwargs)

Handles a violation according to the policy.

Arguments:

  • message str - The message to log or include in the exception.
  • exception_cls Optional[Type[FabricError]] - Specific exception to raise if action is 'stop'.
  • **kwargs - Additional data to format into the message if it's a template.

STOP_POLICY

WARN_POLICY

SKIP_POLICY

ViolationRegistry Objects

class ViolationRegistry()

Utility to manage map from config keys to policies.

get_policy

@classmethod
def get_policy(cls,
action_string: Optional[str],
default_action: str = ViolationPolicy.WARN) -> ViolationPolicy

Returns a ViolationPolicy based on a configuration string. Caching instances to reduce overhead.