Skip to content

Commit

Permalink
✨ add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Sep 28, 2023
1 parent 0bf8c1f commit 58c3dfc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arpes/endstations/fits_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import warnings
from ast import literal_eval
from collections.abc import Callable, Iterable
from logging import DEBUG, Formatter, StreamHandler, getLogger
from typing import TYPE_CHECKING, Any, TypeAlias

import numpy as np
Expand All @@ -22,6 +23,18 @@
"find_clean_coords",
)

LOGLEVEL = DEBUG
logger = getLogger(__name__)
fmt = "%(asctime)s %(levelname)s %(name)s :%(message)s"
formatter = Formatter(fmt)
handler = StreamHandler()
handler.setLevel(LOGLEVEL)
logger.setLevel(LOGLEVEL)
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.propagate = False


DEFAULT_DIMENSION_RENAMINGS: dict[str, str] = {
"Beta": "beta",
"Theta": "theta",
Expand Down
13 changes: 13 additions & 0 deletions arpes/fits/fit_models/x_model_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import operator
import warnings
from logging import DEBUG, Formatter, StreamHandler, getLogger
from typing import TYPE_CHECKING

import lmfit as lf
Expand All @@ -20,6 +21,18 @@
__all__ = ["XModelMixin", "gaussian_convolve"]


LOGLEVEL = DEBUG
logger = getLogger(__name__)
fmt = "%(asctime)s %(levelname)s %(name)s :%(message)s"
formatter = Formatter(fmt)
handler = StreamHandler()
handler.setLevel(LOGLEVEL)
logger.setLevel(LOGLEVEL)
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.propagate = False


def dict_to_parameters(dict_of_parameters: dict[str, Any]) -> lf.Parameters:
"""[TODO:summary].
Expand Down
13 changes: 13 additions & 0 deletions arpes/plotting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from collections import Counter
from collections.abc import Sequence
from datetime import UTC
from logging import DEBUG, Formatter, StreamHandler, getLogger
from pathlib import Path
from typing import TYPE_CHECKING, Literal, Unpack

Expand Down Expand Up @@ -107,6 +108,18 @@
"h_gradient_fill",
)

LOGLEVEL = DEBUG
logger = getLogger(__name__)
fmt = "%(asctime)s %(levelname)s %(name)s :%(message)s"
formatter = Formatter(fmt)
handler = StreamHandler()
handler.setLevel(LOGLEVEL)
logger.setLevel(LOGLEVEL)
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.propagate = False


TwoDimensional = 2


Expand Down
12 changes: 12 additions & 0 deletions arpes/xarray_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import itertools
import warnings
from collections import OrderedDict
from logging import DEBUG, Formatter, StreamHandler, getLogger
from typing import TYPE_CHECKING, Any, Literal, TypeAlias

import lmfit
Expand Down Expand Up @@ -95,6 +96,17 @@

ANGLE_VARS = ("alpha", "beta", "chi", "psi", "phi", "theta")

LOGLEVEL = DEBUG
logger = getLogger(__name__)
fmt = "%(asctime)s %(levelname)s %(name)s :%(message)s"
formatter = Formatter(fmt)
handler = StreamHandler()
handler.setLevel(LOGLEVEL)
logger.setLevel(LOGLEVEL)
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.propagate = False


def _iter_groups(grouped: dict[str, Any]) -> Generator:
"""Iterates through a flattened sequence.
Expand Down

0 comments on commit 58c3dfc

Please sign in to comment.