1919from .model import Preamble
2020from .model import String
2121
22+ logger = logging .getLogger (__name__ )
23+
2224
2325class Splitter :
2426 """Object responsible for splitting a BibTeX string into blocks.
@@ -254,7 +256,7 @@ def split(self, library: Optional[Library] = None) -> Library:
254256 if library is None :
255257 library = Library ()
256258 else :
257- logging .info ("Adding blocks to existing library." )
259+ logger .info ("Adding blocks to existing library." )
258260
259261 while True :
260262 m = self ._next_mark (accept_eof = True )
@@ -283,12 +285,12 @@ def split(self, library: Optional[Library] = None) -> Library:
283285 library .add (self ._handle_entry (m , m_val ))
284286
285287 except BlockAbortedException as e :
286- logging .warning (
288+ logger .warning (
287289 f"Parsing of `{ m_val } ` block (line { start_line } ) "
288290 f"aborted on line { self ._current_line } "
289291 f"due to syntactical error in bibtex:\n { e .abort_reason } "
290292 )
291- logging .info (
293+ logger .info (
292294 "We will try to continue parsing, but this might lead to unexpected results."
293295 "The failed block will be stored in the `failed_blocks`of the library."
294296 )
@@ -302,14 +304,14 @@ def split(self, library: Optional[Library] = None) -> Library:
302304
303305 except ParserStateException as e :
304306 # This is a bug in the parser, not in the bibtex. We should not continue.
305- logging .error (
307+ logger .error (
306308 "python-bibtexparser detected an invalid state. Please report this bug."
307309 )
308- logging .error (e .message )
310+ logger .error (e .message )
309311 raise e
310312 except Exception as e :
311313 # For unknown exeptions, we want to fail hard and get the info in our issue tracker.
312- logging .error (
314+ logger .error (
313315 f"Unexpected exception while parsing `{ m_val } ` block (line { start_line } )"
314316 "Please report this bug."
315317 )
0 commit comments