the singleton pattern enter the objects classes in python allow you to define logical groupings of data and functions they also allow you to add some contextual data to the logger (like which file you want to write toto get the most out of classesyou need to think in slightly new way this grouping of functions and data that relate to each other into class forms blueprint for creating specific instances (versionof the data combined with their associated functions an instance of class is called an object to help you understand thisconsider for moment the logger we have just developed if we were able to generalize this logger in such way that we could send it the name of the file to use when we use itwe would have blueprint to create any logger ( classthe moment we make this callwe effectively create new logger that writes to specific file this new logger is called an instance of the class thinking about data and the functions that alter the data as single entity is the basis for object-oriented programming we will now implement simple logger class as an example logger_class py class logger(object)""" file-based message logger with the following properties attributesfile_namea string representing the full path of the log file to which this logger will write its messages ""def __init__(selffile_name)"""return logger object whose file_name is *file_name*""self file_name file_name def _write_log(selflevelmsg)"""writes message to the file_name for specific logger instance""with open(self file_name" "as log_filelog_file write("[{ }{ }\nformat(levelmsg)def critical(selflevelmsg)self _write_log("critical",msg