Expand description

The Bridge design pattern example module

In this example, 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.

Take note of how the calls into the logger are the same regardless of the logger used.

Accessed through the bridge_exercise() function.

Modules

  • Contains the ConsoleLogger implementation.
  • Contains the FileLogger implementation.
  • Contains the ILogger trait that loggers can implement.
  • Contains the LoggerType enumeration and the create_logger() factory function for instantiating specific kinds of loggers that implement the ILogger trait.
  • Contains the loghelper_formatlogline() function for formatting a complete line to be written to a log.
  • Contains the NullLogger implementation.

Functions