-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger_messages.py
More file actions
172 lines (133 loc) · 5.83 KB
/
logger_messages.py
File metadata and controls
172 lines (133 loc) · 5.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
"""
Holds all log messages to remove "magic strings" from the codebase and make reviewing confusing messages easier.
"""
__author__ = "Rosetta Reatherford"
__license__ = "AGPL v3"
__maintainer__ = "The Public Library of Science (PLOS)"
from plugins.editorial_manager_transfer_service.consts import PLUGIN_NAME, EXPORT_FILE_PATH, IMPORT_FILE_PATH
def plugin_installation_beginning() -> str:
"""
Gets the log message for a plugin beginning installation.
:return: The logger message.
"""
return '{0} installation beginning...'.format(PLUGIN_NAME)
def plugin_installed() -> str:
"""
Gets the log message for a plugin being successfully installed.
:return: The logger message.
"""
return '{0} installed.'.format(PLUGIN_NAME)
def plugin_already_installed() -> str:
"""
Gets the log message for a plugin has been previously installed.
:return: The logger message.
"""
return '{0} is already installed.'.format(PLUGIN_NAME)
def export_folder_creating() -> str:
"""
Gets the log message for when an export folder is being created.
:return: The logger message.
"""
return '{0} creating export folder (Filepath: \"{1}\")...'.format(PLUGIN_NAME, EXPORT_FILE_PATH)
def export_folder_created() -> str:
"""
Gets the log message for when an export folder has been created.
:return: The logger message.
"""
return '{0} export folder already exists.'.format(PLUGIN_NAME)
def import_folder_creating() -> str:
"""
Gets the log message for when an import folder is being created.
:return: The logger message.
"""
return '{0} creating import folder (Filepath: \"{1}\")...'.format(PLUGIN_NAME, IMPORT_FILE_PATH)
def import_folder_created() -> str:
"""
Gets the log message for when an import folder has been created.
:return: The logger message.
"""
return '{0} import folder already exists.'.format(PLUGIN_NAME)
def process_fetching_article(article_id: int) -> str:
"""
Gets the log message for when an article is being fetched from the database.
:param: article_id: The ID of the article being fetched.
:return: The logger message.
"""
return "Fetching article from database (ID: {0})...".format(article_id)
def process_finished_fetching_article(article_id: int) -> str:
"""
Gets the log message for when an article is being fetched from the database.
:param: article_id: The ID of the article being fetched.
:return: The logger message.
"""
return "Completed fetching article from database (ID: {0})...".format(article_id)
def process_fetching_journal(janeway_journal_code: str) -> str:
"""
Gets the log message for when a journal is being fetched from the database.
:param: janway_journal_code: The code of the journal being fetched.
:return: The logger message.
"""
return "Fetching journal from database (Code: {0})...".format(janeway_journal_code)
def process_finished_fetching_journal(janeway_journal_code: str) -> str:
"""
Gets the log message for when a journal is being fetched from the database.
:param: janway_journal_code: The code of the journal being fetched.
:return: The logger message.
"""
return "Completed fetching journal from database (Code: {0})...".format(janeway_journal_code)
def process_failed_fetching_article_files(article_id) -> str:
"""
Gets the log message for when an article's files failed to be fetched.
:param: article_id: The ID of the article being fetched.
:return: The logger message.
"""
return "Fetching files for article (ID: {0}) failed. Discontinuing export process.".format(article_id)
def process_failed_fetching_metadata(article_id) -> str:
"""
Gets the log message for when an article's metadata failed to be fetched.
:param: article_id: The ID of the article being fetched.
:return: The logger message.
"""
return "Fetching article (ID: {0}) metadata failed. Discontinuing export process.".format(article_id)
def export_process_failed_no_export_folder() -> str:
"""
Gets the log message for when an export folder was not created.
:return: The logger message.
"""
return "No export folder provided. Discontinuing export process."
def __export_process_failed_ingest(article_id: int) -> str:
"""
Gets the log message for when the article failed to be ingested into Editorial Manager.
:param article_id: The ID of the article being fetched.
:return: The logger message.
"""
return "Export process failed during ingest to Editorial Manager for article (ID: {0})".format(article_id)
def export_process_failed_ingest(article_id: int, error_message: str = None) -> str:
"""
Gets the log message for when the article failed to be ingested into Editorial Manager.
:param article_id: The ID of the article being fetched.
:param error_message: The error message to be logged.
:return: The logger message.
"""
if error_message:
return error_message
return __export_process_failed_ingest(article_id)
def export_go_file_process_succeeded(article_id: int) -> str:
"""
Gets the log message for when the export process was successful.
:return: The logger message.
"""
return "Export process succeeded for article (ID: {0}).".format(article_id)
def export_zip_file_process_succeeded(article_id: int) -> str:
"""
Gets the log message for when the export process was successful.
:return: The logger message.
"""
return "Export process succeeded for the zip file for article (ID: {0}).".format(article_id)
def export_process_failed_delete_file(filepath: str) -> str:
"""
Gets the log message for when an export file failed to be deleted.
:param filepath: The path to the export file.
:return: The logger message.
"""
return "Export process failed to delete file at filepath: {0}.".format(filepath)