Show More
@@ -0,0 +1,25 b'' | |||||
|
1 | """Grab the global logger instance.""" | |||
|
2 | ||||
|
3 | # Copyright (c) IPython Development Team. | |||
|
4 | # Distributed under the terms of the Modified BSD License. | |||
|
5 | ||||
|
6 | import logging | |||
|
7 | ||||
|
8 | _logger = None | |||
|
9 | ||||
|
10 | def get_logger(): | |||
|
11 | """Grab the global logger instance. | |||
|
12 | ||||
|
13 | If a global IPython Application is instantiated, grab its logger. | |||
|
14 | Otherwise, grab the root logger. | |||
|
15 | """ | |||
|
16 | global _logger | |||
|
17 | ||||
|
18 | if _logger is None: | |||
|
19 | from IPython.config import Application | |||
|
20 | if Application.initialized(): | |||
|
21 | _logger = Application.instance().log | |||
|
22 | else: | |||
|
23 | logging.basicConfig() | |||
|
24 | _logger = logging.getLogger() | |||
|
25 | return _logger |
General Comments 0
You need to be logged in to leave comments.
Login now