Design Pattern Examples
Overview of object-oriented design patterns
DesignPatternExamples_python.bridge.bridge_exercise Namespace Reference

Functions

None _Bridge_Exercise_Demonstrate_Logging (Logger logger, str loggerType)
 Helper function to show an example of writing to a logger.
 
def Bridge_Exercise ()
 Example of using the Bridge Pattern.
 

Function Documentation

◆ _Bridge_Exercise_Demonstrate_Logging()

None _Bridge_Exercise_Demonstrate_Logging ( Logger  logger,
str  loggerType 
)
protected

Helper function to show an example of writing to a logger.

This is called for all types of loggers, showing how the Logger class hides the details of the underlying implementation.

Parameters
loggerA Logger instance to log to
loggerTypeThe type of the underlying implementation.

Definition at line 17 of file bridge_exercise.py.

Referenced by DesignPatternExamples_python.bridge.bridge_exercise.Bridge_Exercise().

◆ Bridge_Exercise()

def Bridge_Exercise ( void  )

Example of using the Bridge Pattern.

The Bridge pattern is used to allow a program to offer multiple ways to perform logging without changing how the logging is used throughout the program.

In this exercise, note how the calls into the logger are the same regardless of the logger used.

Definition at line 34 of file bridge_exercise.py.

References DesignPatternExamples_python.bridge.bridge_exercise._Bridge_Exercise_Demonstrate_Logging().