Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
ENH #148 start the layout with logging
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Feb 10, 2020
1 parent 8537f90 commit 1b9282e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Empty file.
32 changes: 32 additions & 0 deletions profile_bluesky/startup/instrument/session_logs.py
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}')
1 change: 1 addition & 0 deletions profile_bluesky/startup/instrument/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .explorer import *

0 comments on commit 1b9282e

Please sign in to comment.