loris_log.customLog

The CustomLogMessage that contains the custom log message

  1"""
  2The CustomLogMessage that contains the custom log message
  3"""
  4import os
  5import inspect
  6import uuid
  7import sys
  8from .myException import InvalidMessageException,\
  9    EmptyParameterException,\
 10    NoneValueException,\
 11    InvalidAttributeException
 12
 13# pylint: disable=W0212
 14class CustomLog:
 15    """
 16    Class to construct the log message (info, error, debug, fatal, log data).
 17    """
 18
 19    @staticmethod
 20    def set_error_message(uu_id, name, message):
 21        """
 22        Set up the format of the error message.
 23
 24        Args:\n
 25            uu_id (string): The generated uuid.
 26            name (string): The name of the application or API.
 27            message (array): The error message.
 28
 29        Returns:\n
 30            string: The custom error message.
 31            
 32        Raises NoneValueException:\n
 33            If the uu_id, name or message of a None.
 34            
 35        Raises EmptyParameterException:\n
 36            If the uu_id is not of length 36, or name is
 37            empty.
 38            
 39        Raises InvalidAttributeException:\n
 40            If the uu_id is not of type uuid, name is not of type string,
 41            and message is not of type list.
 42            
 43        Raises InvalidMessageException:\n
 44            if the error message creation is a failure.
 45        """
 46        if uu_id is None or name is None or message is None:
 47            raise NoneValueException()
 48
 49        if len(str(uu_id)) != 36 or len(str(name)) == 0:
 50            raise EmptyParameterException()
 51
 52        if isinstance(uu_id, uuid.UUID) is False or\
 53            isinstance(name, str) is False or\
 54            isinstance(message, list) is False:
 55            raise InvalidAttributeException()
 56
 57        try:
 58            error_message = f"[ERROR] [{str(uu_id)}] [{str(name)}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
 59            return error_message
 60        except TypeError as exc:
 61            raise InvalidMessageException() from exc
 62
 63    @staticmethod
 64    def set_debug_message(uu_id, name, message):
 65        """
 66        Set up the format of the debug message
 67
 68        Args:\n
 69            uu_id (string): The generated uuid.
 70            name (string): The name of the application/ API/ function/ feature.
 71            message (list): The error message.
 72
 73        Returns:\n
 74            string: The custom debug message.
 75            
 76        Raises NoneValueException:\n
 77            If the uu_id, name or message is a none value.
 78            
 79        Raises EmptyParameterException:\n
 80            If the uu_id is not of length 36 or the name 
 81            is empty.
 82            
 83        Raises InvalidAttributeException:\n
 84            If the uu_id is not of type uuid, name is not
 85            of type string, and message is not of type list.
 86            
 87        Raises InvalidMessageException:\n
 88            If the log creation failed.
 89        """
 90        if uu_id is None or name is None or message is None:
 91            raise NoneValueException()
 92
 93        if len(str(uu_id)) != 36 or len(str(name)) == 0:
 94            raise EmptyParameterException()
 95
 96        if isinstance(uu_id, uuid.UUID) is False or\
 97            isinstance(name, str) is False or\
 98            isinstance(message, list) is False:
 99            raise InvalidAttributeException()
100
101        try:
102            debug_message = f"[DEBUG] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
103            return debug_message
104        except TypeError as exc:
105            raise InvalidMessageException() from exc
106
107    @staticmethod
108    def set_fatal_message(uu_id, name, message):
109        """
110        Set up the format of the fatal message.
111
112        Args:\n
113            uu_id (string): The generated uuid.
114            name (string): The name of the application/api/function/feature.
115            message (list): The error message.
116
117        Returns:\n
118            string: The custom fatal message.
119            
120        Raises NoneValueException:\n
121            If the uu_id, name or message is a none value.
122            
123        Raises EmptyParameterException:\n
124            If the uu_id is not of length 36 or the name 
125            is empty.
126            
127        Raises InvalidAttributeException:\n
128            If the uu_id is not of type uuid, name is not
129            of type string, and message is not of type list.
130            
131        Raises InvalidMessageException:\n
132            If the log creation failed.
133        """
134        if uu_id is None or name is None or message is None:
135            raise NoneValueException()
136
137        if len(str(uu_id)) != 36 or len(str(name)) == 0:
138            raise EmptyParameterException()
139
140        if isinstance(uu_id, uuid.UUID) is False or\
141            isinstance(name, str) is False or\
142            isinstance(message, list) is False:
143            raise InvalidAttributeException()
144
145        try:
146            fatal_message = f"[FATAL] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
147            return fatal_message
148        except TypeError as exc:
149            raise InvalidMessageException() from exc
150
151    @staticmethod
152    def set_info_message(uu_id, name, message):
153        """
154        Set up the format of the info message.
155
156        Args:\n
157            uu_id (string): The generated uuid.
158            name (string): The name of the application or API
159            message (list): The error message.
160
161        Returns:\n
162            string: The custom info message.
163        
164        Raises NoneValueException:\n
165            If the uu_id, name or message is a none value.
166            
167        Raises EmptyParameterException:\n
168            If the uu_id is not of length 36 or the name 
169            is empty.
170            
171        Raises InvalidAttributeException:\n
172            If the uu_id is not of type uuid, name is not
173            of type string, and message is not of type list.
174            
175        Raises InvalidMessageException:\n
176            If the log creation failed.
177        """
178        if uu_id is None or name is None or message is None:
179            raise NoneValueException()
180
181        if len(str(uu_id)) != 36 or len(str(name)) == 0:
182            raise EmptyParameterException()
183
184        if isinstance(uu_id, uuid.UUID) is False or\
185            isinstance(name, str) is False or\
186            isinstance(message, list) is False:
187            raise InvalidAttributeException()
188
189        try:
190            info_message = f"[INFO] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
191            return info_message
192        except TypeError as exc:
193            raise InvalidMessageException() from exc
194
195    @staticmethod
196    def set_ftp_log_data(uu_id, starttime, endtime, result, groundtruth):
197        """
198        Set up the log message for the FTP system.
199
200        Args:\n
201            uuid (string): The generated uuid.
202            starttime (string): the start time of an operation.
203            endtime (string): the end time of an operation.
204            result (string): the result of the embedded device/ system/ model etc.
205            groundtruth (string): the result of the embedded device/ system/ model etc.
206
207        Returns:\n
208            string: a list of log data.
209            
210        Raises NoneValueException:\n
211            If the uu_id, name or message is a none value.
212            
213        Raises EmptyParameterException:\n
214            If the uu_id is not of length 36 or the name 
215            is empty.
216            
217        Raises InvalidAttributeException:\n
218            If the uu_id is not of type uuid, name is not
219            of type string, and message is not of type list.
220            
221        Raises InvalidMessageException:\n
222            If the log creation failed.
223        """
224        if uu_id is None or starttime is None\
225           or endtime is None or result is None or\
226           groundtruth is None:
227            raise NoneValueException()
228
229        if isinstance(uu_id, uuid.UUID) is False or\
230            isinstance(starttime, str) is False or\
231            isinstance(endtime, str) is False:
232            raise InvalidAttributeException()
233
234        if len(str(uu_id)) == 0 or len(str(starttime)) == 0\
235            or len(str(endtime)) == 0 or len(result) == 0\
236            or len(str(groundtruth)) == 0:
237            raise EmptyParameterException()
238
239        try:
240            data_message = bytes(f"{str(uuid)},{str(starttime)},\
241                {str(endtime)},{float(result)},{float(groundtruth)}\n", encoding='utf-8')
242            return data_message
243        except ValueError as exc:
244            raise InvalidMessageException() from exc
class CustomLog:
 15class CustomLog:
 16    """
 17    Class to construct the log message (info, error, debug, fatal, log data).
 18    """
 19
 20    @staticmethod
 21    def set_error_message(uu_id, name, message):
 22        """
 23        Set up the format of the error message.
 24
 25        Args:\n
 26            uu_id (string): The generated uuid.
 27            name (string): The name of the application or API.
 28            message (array): The error message.
 29
 30        Returns:\n
 31            string: The custom error message.
 32            
 33        Raises NoneValueException:\n
 34            If the uu_id, name or message of a None.
 35            
 36        Raises EmptyParameterException:\n
 37            If the uu_id is not of length 36, or name is
 38            empty.
 39            
 40        Raises InvalidAttributeException:\n
 41            If the uu_id is not of type uuid, name is not of type string,
 42            and message is not of type list.
 43            
 44        Raises InvalidMessageException:\n
 45            if the error message creation is a failure.
 46        """
 47        if uu_id is None or name is None or message is None:
 48            raise NoneValueException()
 49
 50        if len(str(uu_id)) != 36 or len(str(name)) == 0:
 51            raise EmptyParameterException()
 52
 53        if isinstance(uu_id, uuid.UUID) is False or\
 54            isinstance(name, str) is False or\
 55            isinstance(message, list) is False:
 56            raise InvalidAttributeException()
 57
 58        try:
 59            error_message = f"[ERROR] [{str(uu_id)}] [{str(name)}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
 60            return error_message
 61        except TypeError as exc:
 62            raise InvalidMessageException() from exc
 63
 64    @staticmethod
 65    def set_debug_message(uu_id, name, message):
 66        """
 67        Set up the format of the debug message
 68
 69        Args:\n
 70            uu_id (string): The generated uuid.
 71            name (string): The name of the application/ API/ function/ feature.
 72            message (list): The error message.
 73
 74        Returns:\n
 75            string: The custom debug message.
 76            
 77        Raises NoneValueException:\n
 78            If the uu_id, name or message is a none value.
 79            
 80        Raises EmptyParameterException:\n
 81            If the uu_id is not of length 36 or the name 
 82            is empty.
 83            
 84        Raises InvalidAttributeException:\n
 85            If the uu_id is not of type uuid, name is not
 86            of type string, and message is not of type list.
 87            
 88        Raises InvalidMessageException:\n
 89            If the log creation failed.
 90        """
 91        if uu_id is None or name is None or message is None:
 92            raise NoneValueException()
 93
 94        if len(str(uu_id)) != 36 or len(str(name)) == 0:
 95            raise EmptyParameterException()
 96
 97        if isinstance(uu_id, uuid.UUID) is False or\
 98            isinstance(name, str) is False or\
 99            isinstance(message, list) is False:
100            raise InvalidAttributeException()
101
102        try:
103            debug_message = f"[DEBUG] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
104            return debug_message
105        except TypeError as exc:
106            raise InvalidMessageException() from exc
107
108    @staticmethod
109    def set_fatal_message(uu_id, name, message):
110        """
111        Set up the format of the fatal message.
112
113        Args:\n
114            uu_id (string): The generated uuid.
115            name (string): The name of the application/api/function/feature.
116            message (list): The error message.
117
118        Returns:\n
119            string: The custom fatal message.
120            
121        Raises NoneValueException:\n
122            If the uu_id, name or message is a none value.
123            
124        Raises EmptyParameterException:\n
125            If the uu_id is not of length 36 or the name 
126            is empty.
127            
128        Raises InvalidAttributeException:\n
129            If the uu_id is not of type uuid, name is not
130            of type string, and message is not of type list.
131            
132        Raises InvalidMessageException:\n
133            If the log creation failed.
134        """
135        if uu_id is None or name is None or message is None:
136            raise NoneValueException()
137
138        if len(str(uu_id)) != 36 or len(str(name)) == 0:
139            raise EmptyParameterException()
140
141        if isinstance(uu_id, uuid.UUID) is False or\
142            isinstance(name, str) is False or\
143            isinstance(message, list) is False:
144            raise InvalidAttributeException()
145
146        try:
147            fatal_message = f"[FATAL] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
148            return fatal_message
149        except TypeError as exc:
150            raise InvalidMessageException() from exc
151
152    @staticmethod
153    def set_info_message(uu_id, name, message):
154        """
155        Set up the format of the info message.
156
157        Args:\n
158            uu_id (string): The generated uuid.
159            name (string): The name of the application or API
160            message (list): The error message.
161
162        Returns:\n
163            string: The custom info message.
164        
165        Raises NoneValueException:\n
166            If the uu_id, name or message is a none value.
167            
168        Raises EmptyParameterException:\n
169            If the uu_id is not of length 36 or the name 
170            is empty.
171            
172        Raises InvalidAttributeException:\n
173            If the uu_id is not of type uuid, name is not
174            of type string, and message is not of type list.
175            
176        Raises InvalidMessageException:\n
177            If the log creation failed.
178        """
179        if uu_id is None or name is None or message is None:
180            raise NoneValueException()
181
182        if len(str(uu_id)) != 36 or len(str(name)) == 0:
183            raise EmptyParameterException()
184
185        if isinstance(uu_id, uuid.UUID) is False or\
186            isinstance(name, str) is False or\
187            isinstance(message, list) is False:
188            raise InvalidAttributeException()
189
190        try:
191            info_message = f"[INFO] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
192            return info_message
193        except TypeError as exc:
194            raise InvalidMessageException() from exc
195
196    @staticmethod
197    def set_ftp_log_data(uu_id, starttime, endtime, result, groundtruth):
198        """
199        Set up the log message for the FTP system.
200
201        Args:\n
202            uuid (string): The generated uuid.
203            starttime (string): the start time of an operation.
204            endtime (string): the end time of an operation.
205            result (string): the result of the embedded device/ system/ model etc.
206            groundtruth (string): the result of the embedded device/ system/ model etc.
207
208        Returns:\n
209            string: a list of log data.
210            
211        Raises NoneValueException:\n
212            If the uu_id, name or message is a none value.
213            
214        Raises EmptyParameterException:\n
215            If the uu_id is not of length 36 or the name 
216            is empty.
217            
218        Raises InvalidAttributeException:\n
219            If the uu_id is not of type uuid, name is not
220            of type string, and message is not of type list.
221            
222        Raises InvalidMessageException:\n
223            If the log creation failed.
224        """
225        if uu_id is None or starttime is None\
226           or endtime is None or result is None or\
227           groundtruth is None:
228            raise NoneValueException()
229
230        if isinstance(uu_id, uuid.UUID) is False or\
231            isinstance(starttime, str) is False or\
232            isinstance(endtime, str) is False:
233            raise InvalidAttributeException()
234
235        if len(str(uu_id)) == 0 or len(str(starttime)) == 0\
236            or len(str(endtime)) == 0 or len(result) == 0\
237            or len(str(groundtruth)) == 0:
238            raise EmptyParameterException()
239
240        try:
241            data_message = bytes(f"{str(uuid)},{str(starttime)},\
242                {str(endtime)},{float(result)},{float(groundtruth)}\n", encoding='utf-8')
243            return data_message
244        except ValueError as exc:
245            raise InvalidMessageException() from exc

Class to construct the log message (info, error, debug, fatal, log data).

@staticmethod
def set_error_message(uu_id, name, message):
20    @staticmethod
21    def set_error_message(uu_id, name, message):
22        """
23        Set up the format of the error message.
24
25        Args:\n
26            uu_id (string): The generated uuid.
27            name (string): The name of the application or API.
28            message (array): The error message.
29
30        Returns:\n
31            string: The custom error message.
32            
33        Raises NoneValueException:\n
34            If the uu_id, name or message of a None.
35            
36        Raises EmptyParameterException:\n
37            If the uu_id is not of length 36, or name is
38            empty.
39            
40        Raises InvalidAttributeException:\n
41            If the uu_id is not of type uuid, name is not of type string,
42            and message is not of type list.
43            
44        Raises InvalidMessageException:\n
45            if the error message creation is a failure.
46        """
47        if uu_id is None or name is None or message is None:
48            raise NoneValueException()
49
50        if len(str(uu_id)) != 36 or len(str(name)) == 0:
51            raise EmptyParameterException()
52
53        if isinstance(uu_id, uuid.UUID) is False or\
54            isinstance(name, str) is False or\
55            isinstance(message, list) is False:
56            raise InvalidAttributeException()
57
58        try:
59            error_message = f"[ERROR] [{str(uu_id)}] [{str(name)}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
60            return error_message
61        except TypeError as exc:
62            raise InvalidMessageException() from exc

Set up the format of the error message.

Args:

uu_id (string): The generated uuid.
name (string): The name of the application or API.
message (array): The error message.

Returns:

string: The custom error message.

Raises NoneValueException:

If the uu_id, name or message of a None.

Raises EmptyParameterException:

If the uu_id is not of length 36, or name is
empty.

Raises InvalidAttributeException:

If the uu_id is not of type uuid, name is not of type string,
and message is not of type list.

Raises InvalidMessageException:

if the error message creation is a failure.
@staticmethod
def set_debug_message(uu_id, name, message):
 64    @staticmethod
 65    def set_debug_message(uu_id, name, message):
 66        """
 67        Set up the format of the debug message
 68
 69        Args:\n
 70            uu_id (string): The generated uuid.
 71            name (string): The name of the application/ API/ function/ feature.
 72            message (list): The error message.
 73
 74        Returns:\n
 75            string: The custom debug message.
 76            
 77        Raises NoneValueException:\n
 78            If the uu_id, name or message is a none value.
 79            
 80        Raises EmptyParameterException:\n
 81            If the uu_id is not of length 36 or the name 
 82            is empty.
 83            
 84        Raises InvalidAttributeException:\n
 85            If the uu_id is not of type uuid, name is not
 86            of type string, and message is not of type list.
 87            
 88        Raises InvalidMessageException:\n
 89            If the log creation failed.
 90        """
 91        if uu_id is None or name is None or message is None:
 92            raise NoneValueException()
 93
 94        if len(str(uu_id)) != 36 or len(str(name)) == 0:
 95            raise EmptyParameterException()
 96
 97        if isinstance(uu_id, uuid.UUID) is False or\
 98            isinstance(name, str) is False or\
 99            isinstance(message, list) is False:
100            raise InvalidAttributeException()
101
102        try:
103            debug_message = f"[DEBUG] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
104            return debug_message
105        except TypeError as exc:
106            raise InvalidMessageException() from exc

Set up the format of the debug message

Args:

uu_id (string): The generated uuid.
name (string): The name of the application/ API/ function/ feature.
message (list): The error message.

Returns:

string: The custom debug message.

Raises NoneValueException:

If the uu_id, name or message is a none value.

Raises EmptyParameterException:

If the uu_id is not of length 36 or the name 
is empty.

Raises InvalidAttributeException:

If the uu_id is not of type uuid, name is not
of type string, and message is not of type list.

Raises InvalidMessageException:

If the log creation failed.
@staticmethod
def set_fatal_message(uu_id, name, message):
108    @staticmethod
109    def set_fatal_message(uu_id, name, message):
110        """
111        Set up the format of the fatal message.
112
113        Args:\n
114            uu_id (string): The generated uuid.
115            name (string): The name of the application/api/function/feature.
116            message (list): The error message.
117
118        Returns:\n
119            string: The custom fatal message.
120            
121        Raises NoneValueException:\n
122            If the uu_id, name or message is a none value.
123            
124        Raises EmptyParameterException:\n
125            If the uu_id is not of length 36 or the name 
126            is empty.
127            
128        Raises InvalidAttributeException:\n
129            If the uu_id is not of type uuid, name is not
130            of type string, and message is not of type list.
131            
132        Raises InvalidMessageException:\n
133            If the log creation failed.
134        """
135        if uu_id is None or name is None or message is None:
136            raise NoneValueException()
137
138        if len(str(uu_id)) != 36 or len(str(name)) == 0:
139            raise EmptyParameterException()
140
141        if isinstance(uu_id, uuid.UUID) is False or\
142            isinstance(name, str) is False or\
143            isinstance(message, list) is False:
144            raise InvalidAttributeException()
145
146        try:
147            fatal_message = f"[FATAL] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
148            return fatal_message
149        except TypeError as exc:
150            raise InvalidMessageException() from exc

Set up the format of the fatal message.

Args:

uu_id (string): The generated uuid.
name (string): The name of the application/api/function/feature.
message (list): The error message.

Returns:

string: The custom fatal message.

Raises NoneValueException:

If the uu_id, name or message is a none value.

Raises EmptyParameterException:

If the uu_id is not of length 36 or the name 
is empty.

Raises InvalidAttributeException:

If the uu_id is not of type uuid, name is not
of type string, and message is not of type list.

Raises InvalidMessageException:

If the log creation failed.
@staticmethod
def set_info_message(uu_id, name, message):
152    @staticmethod
153    def set_info_message(uu_id, name, message):
154        """
155        Set up the format of the info message.
156
157        Args:\n
158            uu_id (string): The generated uuid.
159            name (string): The name of the application or API
160            message (list): The error message.
161
162        Returns:\n
163            string: The custom info message.
164        
165        Raises NoneValueException:\n
166            If the uu_id, name or message is a none value.
167            
168        Raises EmptyParameterException:\n
169            If the uu_id is not of length 36 or the name 
170            is empty.
171            
172        Raises InvalidAttributeException:\n
173            If the uu_id is not of type uuid, name is not
174            of type string, and message is not of type list.
175            
176        Raises InvalidMessageException:\n
177            If the log creation failed.
178        """
179        if uu_id is None or name is None or message is None:
180            raise NoneValueException()
181
182        if len(str(uu_id)) != 36 or len(str(name)) == 0:
183            raise EmptyParameterException()
184
185        if isinstance(uu_id, uuid.UUID) is False or\
186            isinstance(name, str) is False or\
187            isinstance(message, list) is False:
188            raise InvalidAttributeException()
189
190        try:
191            info_message = f"[INFO] [{uu_id}] [{name}] [{os.path.basename(inspect.stack()[1].filename)}] [line {sys._getframe().f_back.f_lineno}]: {' '.join(word for word in message)}"
192            return info_message
193        except TypeError as exc:
194            raise InvalidMessageException() from exc

Set up the format of the info message.

Args:

uu_id (string): The generated uuid.
name (string): The name of the application or API
message (list): The error message.

Returns:

string: The custom info message.

Raises NoneValueException:

If the uu_id, name or message is a none value.

Raises EmptyParameterException:

If the uu_id is not of length 36 or the name 
is empty.

Raises InvalidAttributeException:

If the uu_id is not of type uuid, name is not
of type string, and message is not of type list.

Raises InvalidMessageException:

If the log creation failed.
@staticmethod
def set_ftp_log_data(uu_id, starttime, endtime, result, groundtruth):
196    @staticmethod
197    def set_ftp_log_data(uu_id, starttime, endtime, result, groundtruth):
198        """
199        Set up the log message for the FTP system.
200
201        Args:\n
202            uuid (string): The generated uuid.
203            starttime (string): the start time of an operation.
204            endtime (string): the end time of an operation.
205            result (string): the result of the embedded device/ system/ model etc.
206            groundtruth (string): the result of the embedded device/ system/ model etc.
207
208        Returns:\n
209            string: a list of log data.
210            
211        Raises NoneValueException:\n
212            If the uu_id, name or message is a none value.
213            
214        Raises EmptyParameterException:\n
215            If the uu_id is not of length 36 or the name 
216            is empty.
217            
218        Raises InvalidAttributeException:\n
219            If the uu_id is not of type uuid, name is not
220            of type string, and message is not of type list.
221            
222        Raises InvalidMessageException:\n
223            If the log creation failed.
224        """
225        if uu_id is None or starttime is None\
226           or endtime is None or result is None or\
227           groundtruth is None:
228            raise NoneValueException()
229
230        if isinstance(uu_id, uuid.UUID) is False or\
231            isinstance(starttime, str) is False or\
232            isinstance(endtime, str) is False:
233            raise InvalidAttributeException()
234
235        if len(str(uu_id)) == 0 or len(str(starttime)) == 0\
236            or len(str(endtime)) == 0 or len(result) == 0\
237            or len(str(groundtruth)) == 0:
238            raise EmptyParameterException()
239
240        try:
241            data_message = bytes(f"{str(uuid)},{str(starttime)},\
242                {str(endtime)},{float(result)},{float(groundtruth)}\n", encoding='utf-8')
243            return data_message
244        except ValueError as exc:
245            raise InvalidMessageException() from exc

Set up the log message for the FTP system.

Args:

uuid (string): The generated uuid.
starttime (string): the start time of an operation.
endtime (string): the end time of an operation.
result (string): the result of the embedded device/ system/ model etc.
groundtruth (string): the result of the embedded device/ system/ model etc.

Returns:

string: a list of log data.

Raises NoneValueException:

If the uu_id, name or message is a none value.

Raises EmptyParameterException:

If the uu_id is not of length 36 or the name 
is empty.

Raises InvalidAttributeException:

If the uu_id is not of type uuid, name is not
of type string, and message is not of type list.

Raises InvalidMessageException:

If the log creation failed.