Commit df0b97cc authored by Davide Ricci's avatar Davide Ricci
Browse files

loguru again

  - Source Commit: c7661f2a
  - Date: 2025-05-30 15:03:41
  - Job ID: 117494
  - Pipeline ID: 29056
  - [skip ci]
parent c7661f2a
Loading
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -207,10 +207,15 @@ class Sequencer():
                log.critical(msg)
                if not self.embedded:
                    log.info("SEQUENCER: EOF in non-embedded mode. Forcing exit.")
                    if hasattr(self, 'tpl') and self.tpl and hasattr(self.tpl, 'abort'):
                    if hasattr(
                            self,
                            'tpl') and self.tpl and hasattr(
                            self.tpl,
                            'abort'):
                        try:
                            self.tpl.abort()
                        except Exception: pass # Best effort
                        except Exception:
                            pass  # Best effort
                    os._exit(1)
                else:
                    log.info("SEQUENCER: EOF in embedded mode. Signaling quit.")
@@ -243,7 +248,9 @@ class Sequencer():
                "SEQUENCER: Interrupted during interrupt handling. Quitting.")
            self.quit()
        except Exception as e:  # Add a broad catch here for debugging
            sys.stderr.write(f"ERROR IN INTERRUPT HANDLER: {type(e).__name__}: {e}\n")
            sys.stderr.write(
                f"ERROR IN INTERRUPT HANDLER: {
                    type(e).__name__}: {e}\n")
            log.error("Error in interrupt handler", exc_info=True)
            # Fallback to quitting if the handler itself fails
            self.quit()
+1 −3
Original line number Diff line number Diff line
@@ -4,13 +4,11 @@
# System modules
from time import sleep

# Third-party modules
from .basetemplate import BaseTemplate

# Other templates
from ..config.constants import on_off
from ..devices import light
from ..utils.logger import log
from .basetemplate import BaseTemplate


class Template(BaseTemplate):
+1 −1
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@ from astropy.time import Time

# Other templates
from ..config.constants import on_off
from ..utils.structure import foc_path
# from devices import lamp, light
from ..utils.logger import log
from ..utils.structure import foc_path
from .basetemplate import BaseTemplate


+12 −7
Original line number Diff line number Diff line
@@ -3,14 +3,17 @@
"""Custom format log"""

# System modules
import sys
import datetime
import os  # Will be used if log_path only returns a directory
import sys

# Third-party modules
from loguru import logger
import datetime

# Other templates
from .structure import log_path


def mylog():
    "logger function"

@@ -46,9 +49,11 @@ def mylog():

    return logger


# This ensures mylog() is called only once.
log = mylog()


def main():
    """Main function"""

+18 −17
Original line number Diff line number Diff line
@@ -13,14 +13,15 @@ from pathlib import Path
from astropy.io import fits
from astropy.time import Time

# Custom modules
from ..config.constants import ( DATA_FOLDER, LOG_FOLDER, FITS_FOLDER,
                                 FOCUS_FOLDER, FILE_PREFIX, dateobs,
                                 dir_type, frame_number, imagetyp,
                                 FITS_EXT, FOCUS_EXT, LOG_EXT )
# Other templates
from ..config.constants import (DATA_FOLDER, FILE_PREFIX, FITS_EXT,
                                FITS_FOLDER, FOCUS_EXT, FOCUS_FOLDER, LOG_EXT,
                                LOG_FOLDER, dateobs, dir_type, frame_number,
                                imagetyp)

PROJECT_ROOT = Path(__file__).parent.parent.parent


def date_folder():
    """Create a date folder string based on astronomical convention
    (changes at midday UTC).
+1 −1

File changed.

Contains only whitespace changes.

Loading