@@ -57,9 +57,8 @@ def closelog():
57
57
58
58
59
59
def _do_syslog (message : str , level : int ) -> str :
60
- for line in wrapLine (message ):
61
- syslog .syslog (level , '{}{}: {}' .format (
62
- SYSLOG_MESSAGE_PREFIX , _level_names [level ], line ))
60
+ syslog .syslog (level , '{}{}: {}' .format (
61
+ SYSLOG_MESSAGE_PREFIX , _level_names [level ], message ))
63
62
64
63
65
64
def error (msg , parent = None , traceDepth = 0 ):
@@ -142,43 +141,3 @@ def _debugHeader(parent, traceDepth):
142
141
143
142
func = frame .f_code .co_name
144
143
return '[%s/%s:%s %s%s]' % (fmodule , fname , line , fclass , func )
145
-
146
-
147
- # This function was moved from tools.py to here to solve a circular
148
- # import dependency between "tools" and "logger".
149
- def wrapLine (msg , size = 950 , delimiters = '\t ' , new_line_indicator = 'CONTINUE: ' ):
150
- """
151
- Wrap line ``msg`` into multiple lines with each shorter than ``size``. Try
152
- to break the line on ``delimiters``. New lines will start with
153
- ``new_line_indicator``.
154
-
155
- Args:
156
- msg (str): string that should get wrapped
157
- size (int): maximum length of returned strings
158
- delimiters (str): try to break ``msg`` on these characters
159
- new_line_indicator (str): start new lines with this string
160
-
161
- Yields:
162
- str: lines with max ``size`` length
163
- """
164
-
165
- # TODO Use "textwrap.wrap" instead (https://docs.python.org/3/library/textwrap.html)
166
- # (which may change the output formatting and may affect unit tests then)
167
- # To avoid duplicated argument values in calls this function could
168
- # act as a wrapper-
169
-
170
- if len (new_line_indicator ) >= size - 1 :
171
- new_line_indicator = ''
172
- while msg :
173
- if len (msg ) <= size :
174
- yield (msg )
175
- break
176
- else :
177
- line = ''
178
- for look in range (size - 1 , size // 2 , - 1 ):
179
- if msg [look ] in delimiters :
180
- line , msg = msg [:look + 1 ], new_line_indicator + msg [look + 1 :]
181
- break
182
- if not line :
183
- line , msg = msg [:size ], new_line_indicator + msg [size :]
184
- yield (line )
0 commit comments