This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH #148 start the layout with logging
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
configure session logging | ||
""" | ||
|
||
import logging | ||
import stdlogpj | ||
|
||
_log_path = os.path.join(os.getcwd(), ".logs") | ||
if not os.path.exists(_log_path): | ||
os.mkdir(_log_path) | ||
CONSOLE_IO_FILE = os.path.join(_log_path, "ipython_console.log") | ||
|
||
# start logging console to file | ||
# https://ipython.org/ipython-doc/3/interactive/magics.html#magic-logstart | ||
from IPython import get_ipython | ||
_ipython = get_ipython() | ||
# %logstart -o -t .ipython_console.log "rotate" | ||
_ipython.magic(f"logstart -o -t {CONSOLE_IO_FILE} rotate") | ||
|
||
BYTE = 1 | ||
kB = 1024 * BYTE | ||
MB = 1024 * kB | ||
logger = stdlogpj.standard_logging_setup( | ||
"bluesky-session", | ||
"ipython_logger", | ||
maxBytes=1*MB, | ||
backupCount=9) | ||
logger.setLevel(logging.DEBUG) | ||
|
||
logger.info('#'*60 + " startup") | ||
logger.info('logging started') | ||
logger.info(f'logging level = {logger.level}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .explorer import * |