spreadsheet now works again
This commit is contained in:
@ -1,15 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
from loguru import logger
|
||||
|
||||
# at the moment this allows us to group the subdirectories as modules easily
|
||||
# TODO: a more general way would be to have this cristallina as a installed package
|
||||
os.chdir("/sf/cristallina/applications/slic/cristallina")
|
||||
|
||||
# setup logging
|
||||
from loguru import logger
|
||||
|
||||
def setup_logging():
|
||||
def setup_general_logging():
|
||||
""" Setup logging to console and files in both the snapshots and
|
||||
the respective pgroup.
|
||||
"""
|
||||
|
||||
logger.remove()
|
||||
logger.add(
|
||||
sys.stderr,
|
||||
@ -19,16 +22,16 @@ def setup_logging():
|
||||
logger.info("Loading started.")
|
||||
|
||||
# create file handler which logs
|
||||
# TODO: better directory for general log files?
|
||||
try:
|
||||
logger.add(
|
||||
"/sf/cristallina/applications/slic/cristallina/log/cristallina.log",
|
||||
"/sf/cristallina/applications/beamline/snapshots/slic_logs/cristallina.log",
|
||||
format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}",
|
||||
level="DEBUG",
|
||||
rotation="1 week",
|
||||
)
|
||||
logger.info("Logging to snapshots.")
|
||||
except PermissionError as e:
|
||||
logger.warning("Cannot write log file.")
|
||||
logger.warning("Cannot write log file to snapshots.")
|
||||
logger.warning(e)
|
||||
|
||||
def setup_logging_pgroup(pgroup, level="INFO"):
|
||||
@ -39,18 +42,16 @@ def setup_logging_pgroup(pgroup, level="INFO"):
|
||||
level=level,
|
||||
rotation="1 week",
|
||||
)
|
||||
logger.info(f"Logging to pgroup {pgroup}.")
|
||||
except PermissionError as e:
|
||||
logger.warning(f"Cannot write log file to pgroup {pgroup}.")
|
||||
|
||||
|
||||
# We setup the logging before going further so that
|
||||
# other modules can write startup messages into the log file.
|
||||
setup_logging()
|
||||
setup_general_logging()
|
||||
|
||||
# TODO: this is later overwritten, probably not intended that way?
|
||||
# from epics import PV
|
||||
|
||||
# from devices.alignment_laser import AlignmentLaser
|
||||
from beamline.alignment_laser import AlignmentLaser
|
||||
|
||||
from slic.gui import GUI
|
||||
from slic.core.adjustable import Adjustable, PVAdjustable, DummyAdjustable
|
||||
@ -94,7 +95,7 @@ dummy = DummyAdjustable(units="au")
|
||||
|
||||
from beamline.components import upstream_attenuator, attenuator, shutter, pulsepicker, front_end_attenuator
|
||||
|
||||
# from beamline.components import kbHor, kbVer
|
||||
from beamline.components import kbHor, kbVer
|
||||
|
||||
from systems.components import cta
|
||||
|
||||
@ -110,7 +111,7 @@ def test_attenuator():
|
||||
logger.warning("No transmission value reported from {attenuator.ID}")
|
||||
|
||||
|
||||
# test_attenuator()
|
||||
test_attenuator()
|
||||
|
||||
# Undulators
|
||||
from beamline import undulator
|
||||
|
Reference in New Issue
Block a user