The Nester Log module
Nester Log is a functionality of Nester added in v0.5.0.
The user can easily query them and get a list with all of his projects, the language they are written in, and their location based from the user’s home directory.
You can find Nester’s log file in ~/.nester.log
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: LogRecord) str
Override logging.Formatter.format function
- process(record: LogRecord) LogRecord
Override logging.Formatter.process function
- nester.nester_log.check_log_for_duplicate(project_name: str) bool
Check for duplicate log entries.
Check the nester.log file in the home directory, whether a given project_name has been taken already. If no log file exists: Continue with the program.
- Parameters:
project_name – 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() None
Check log entries for orphaned projects.
Orphaned projects are projects created and logged by Nester, but the source tree has been removed. 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() None
Create
`.nester.log`
file if it does not exist already.- Param:
None
- Returns:
None
- nester.nester_log.find_all_projects() list[str]
Read the log file and save all project names into a list.
- nester.nester_log.print_log_to_table() None
Read the log file and print its contents into a table.
- Param:
None
- Returns:
None
- nester.nester_log.remove_log_entry(project_name: str, verbose: bool = True) None
Check if the given project appears in the log. If it does, remove the entry from the log.
- Parameters:
project_name (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