The Nester Log module
Nester Log is a functionality of Nester added in v0.5.0.
It allows Nester to log all projects that are created with.
The user can easily query them and get a list with all of his projects, the languages they are written in, and their location based from the user’s home directory.
This module handles Nester’s logging functionality. Nester logs all projects created with it unless the –no-log flag ist set when calling nester create.
- class nester.nester_log.ProjectLogFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
Custom formatter class to handle the custom log fields Nester requires.
- format(record)
Override logging.Formatter.format function
- process(record)
Override logging.Formatter.process function
- nester.nester_log.check_log_for_duplicate(projectname)
Check the nester.log file in the home directory, whether a given projectname has been taken already. If no log file exists: Continue with the program.
- Parameters:
projectname – Name of the project to be checked
- Returns:
True/False depending on whether an entry has been found.
- Return type:
bool
- nester.nester_log.clean_orphaned_entries()
Check all projects listed in the log and see whether their paths are still valid. If not remove the entry.
- Param:
None
- Returns:
None
- nester.nester_log.create_log_file_if_none()
Create ‘.nester.log’ file if it does not exist already.
- Param:
None
- Returns:
None
- nester.nester_log.print_log_to_table()
Read the log file and print its contents into a table.
- Param:
None
- Returns:
None
- nester.nester_log.remove_log_entry(projectname, verbose=True)
Check if the given project appears in the log. If it does, remove the entry from the log.
- Parameters:
projectname (str) – The name of the project to be removed.
verbose (bool) – Flag whether or not to suppress print statements. Needed for clean function.
- Returns:
None