improve plugins

This commit is contained in:
Victor Hall 2023-07-04 17:29:39 -04:00
parent 42c417171d
commit f83934f5d3
1 changed files with 19 additions and 0 deletions

19
plugins/example_plugin.py Normal file
View File

@ -0,0 +1,19 @@
from plugins.plugins import BasePlugin
import logging
from colorama import Fore, Style
class ExampleLoggingPlugin(BasePlugin):
def __init__(self):
print(f"{Fore.LIGHTBLUE_EX}ExampleLoggingPlugin init{Style.RESET_ALL}")
# Setup any state variables here
pass
def on_epoch_start(self, **kwargs):
logging.info(f"{Fore.LIGHTBLUE_EX} ** ExampleLoggingPlugin: on_epoch_start{Style.RESET_ALL}")
for k, v in kwargs.items():
logging.info(f" {Fore.BLUE}{k}: {v}{Style.RESET_ALL}")
def on_epoch_end(self, **kwargs):
logging.info(f"{Fore.LIGHTBLUE_EX} ** ExampleLoggingPlugin: on_epoch_end{Style.RESET_ALL}")
for k, v in kwargs.items():
logging.info(f" {Fore.BLUE}{k}: {v}{Style.RESET_ALL}")