Skip to content

Commit

Permalink
Make core library unopinionated wrt. logging configuration (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Nov 26, 2020
1 parent 67b4c00 commit e93198f
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 481 deletions.
20 changes: 6 additions & 14 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,18 @@ the iteration names and realization indices.
Obtaining warning and error messages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

fmu-ensemble will by default be mute to warnings and error messages,
unless you tell it to be verbose in your client code. The available debug
levels are `DEBUG`, `INFO`, `WARNING`, `ERROR` and `CRITICAL` where `WARNING`
is the default.

Script authors can set a different default logging level by inserting
the lines
Application/script authors can configure logging output to console by e.g.

.. code-block:: python
from fmu.ensemble import etc
fmux = etc.Interaction()
logger = fmux.basiclogger(__name__, level='INFO')
import logging
logging.basicConfig(level=logging.INFO)
while users can always override this by setting an environment variable:
See documentation on `Python logging`_ for more details.

.. code-block:: console
.. _Python logging: https://docs.python.org/3/library/logging.html

export FMU_LOGGING_LEVEL=INFO # If bash shell
setenv FMU_LOGGING_LEVEL INFO # If c-shell (default shell in equinor)

Reading Eclipse data
^^^^^^^^^^^^^^^^^^^^
Expand Down
5 changes: 2 additions & 3 deletions src/fmu/ensemble/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import os
import glob
import dateutil
import logging

import pandas as pd
import numpy as np
import yaml
from ecl import EclDataType
from ecl.eclfile import EclKW

from .etc import Interaction
from .realization import ScratchRealization
from .virtualrealization import VirtualRealization
from .virtualensemble import VirtualEnsemble
Expand All @@ -20,8 +20,7 @@
from .util import shortcut2path
from .util.dates import unionize_smry_dates

xfmu = Interaction()
logger = xfmu.functionlogger(__name__)
logger = logging.getLogger(__name__)


class ScratchEnsemble(object):
Expand Down
6 changes: 2 additions & 4 deletions src/fmu/ensemble/ensemblecombination.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"""Module for handling linear combinations of ensembles"""

import fnmatch
import logging

import pandas as pd

from .etc import Interaction

xfmu = Interaction()
logger = xfmu.functionlogger(__name__)
logger = logging.getLogger(__name__)


class EnsembleCombination(object):
Expand Down
5 changes: 2 additions & 3 deletions src/fmu/ensemble/ensembleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import re
import os
import glob
import logging

import numpy as np
import pandas as pd

from .etc import Interaction
from .ensemble import ScratchEnsemble, VirtualEnsemble

xfmu = Interaction()
logger = xfmu.functionlogger(__name__)
logger = logging.getLogger(__name__)


class EnsembleSet(object):
Expand Down
Loading

0 comments on commit e93198f

Please sign in to comment.