Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore basic logging #177

Merged
merged 2 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion moabb/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from moabb.analysis.results import Results # noqa: F401


log = logging.getLogger()
log = logging.getLogger(__name__)


def analyze(results, out_path, name="analysis", plot=False):
Expand Down
2 changes: 1 addition & 1 deletion moabb/analysis/meta_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import scipy.stats as stats


log = logging.getLogger()
log = logging.getLogger(__name__)


def collapse_session_scores(df):
Expand Down
2 changes: 1 addition & 1 deletion moabb/analysis/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
PIPELINE_PALETTE = sea.color_palette("husl", 6)
sea.set(font="serif", style="whitegrid", palette=PIPELINE_PALETTE, color_codes=False)

log = logging.getLogger()
log = logging.getLogger(__name__)


def _simplify_names(x):
Expand Down
2 changes: 1 addition & 1 deletion moabb/datasets/Weibo2014.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .base import BaseDataset


log = logging.getLogger()
log = logging.getLogger(__name__)

FILES = []
FILES.append("https://dataverse.harvard.edu/api/access/datafile/2499178")
Expand Down
2 changes: 1 addition & 1 deletion moabb/datasets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging


log = logging.getLogger()
log = logging.getLogger(__name__)


class BaseDataset(metaclass=abc.ABCMeta):
Expand Down
2 changes: 1 addition & 1 deletion moabb/datasets/gigadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .base import BaseDataset


log = logging.getLogger()
log = logging.getLogger(__name__)
GIGA_URL = "ftp://parrot.genomics.cn/gigadb/pub/10.5524/100001_101000/100295/mat_data/"


Expand Down
2 changes: 1 addition & 1 deletion moabb/datasets/ssvep_mamem.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# and continues to have the problem, (Issue #254 on wfdb-python)
# better to do pip install git+https://github.com/MIT-LCP/wfdb-python.git

log = logging.getLogger()
log = logging.getLogger(__name__)

# Alternate Download Location
# MAMEM1_URL = 'https://ndownloader.figshare.com/articles/2068677/versions/5'
Expand Down
2 changes: 1 addition & 1 deletion moabb/datasets/ssvep_nakanishi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .base import BaseDataset


log = logging.getLogger()
log = logging.getLogger(__name__)

NAKAHISHI_URL = "https://github.com/mnakanishi/12JFPM_SSVEP/raw/master/data/"

Expand Down
2 changes: 1 addition & 1 deletion moabb/datasets/ssvep_wang.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .base import BaseDataset


log = logging.getLogger()
log = logging.getLogger(__name__)

# WANG_URL = 'http://bci.med.tsinghua.edu.cn/upload/yijun/' # 403 error
# WANG_URL = 'ftp://anonymous@sccn.ucsd.edu/pub/ssvep_benchmark_dataset/'
Expand Down
2 changes: 1 addition & 1 deletion moabb/evaluations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from moabb.paradigms.base import BaseParadigm


log = logging.getLogger()
log = logging.getLogger(__name__)


class BaseEvaluation(ABC):
Expand Down
2 changes: 1 addition & 1 deletion moabb/evaluations/evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from moabb.evaluations.base import BaseEvaluation


log = logging.getLogger()
log = logging.getLogger(__name__)

# Numpy ArrayLike is only available starting from Numpy 1.20 and Python 3.8
Vector = Union[list, tuple, np.ndarray]
Expand Down
2 changes: 1 addition & 1 deletion moabb/paradigms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd


log = logging.getLogger()
log = logging.getLogger(__name__)


class BaseParadigm(metaclass=ABCMeta):
Expand Down
2 changes: 1 addition & 1 deletion moabb/paradigms/motor_imagery.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from moabb.paradigms.base import BaseParadigm


log = logging.getLogger()
log = logging.getLogger(__name__)


class BaseMotorImagery(BaseParadigm):
Expand Down
2 changes: 1 addition & 1 deletion moabb/paradigms/p300.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from moabb.paradigms.base import BaseParadigm


log = logging.getLogger()
log = logging.getLogger(__name__)


class BaseP300(BaseParadigm):
Expand Down
2 changes: 1 addition & 1 deletion moabb/paradigms/ssvep.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from moabb.paradigms.base import BaseParadigm


log = logging.getLogger()
log = logging.getLogger(__name__)


class BaseSSVEP(BaseParadigm):
Expand Down
2 changes: 1 addition & 1 deletion moabb/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from moabb.pipelines.utils import create_pipeline_from_config


log = logging.getLogger()
log = logging.getLogger(__name__)


def parser_init():
Expand Down
2 changes: 1 addition & 1 deletion moabb/tests/paradigms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)


log = logging.getLogger()
log = logging.getLogger(__name__)
log.setLevel(logging.ERROR)


Expand Down
16 changes: 14 additions & 2 deletions moabb/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import logging

import mne


def set_log_level(verbose="info"):
def set_log_level(level="INFO"):
"""Set lot level.
Set the general log level. level can be 'info', 'debug' or 'warning'
Set the general log level.
Use one of the levels supported by python logging, i.e.:
DEBUG, INFO, WARNING, ERROR, CRITICAL
"""
VALID_LEVELS = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
level = level.upper()
if level not in VALID_LEVELS:
raise ValueError(f"Invalid level {level}. Choose one of {VALID_LEVELS}.")
mne.set_log_level(False)
logging.basicConfig(
level=level,
format="%(asctime)s %(levelname)s %(threadName)s %(name)s %(message)s",
)