File: __init__.py

package info (click to toggle)
stactools 0.5.3-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 23,796 kB
  • sloc: python: 4,498; xml: 554; sh: 395; makefile: 34
file content (29 lines) | stat: -rw-r--r-- 566 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import logging

from stactools.testing import TestData


class Logging:
    _logging_setup: bool = False

    @classmethod
    def setup_logging(cls, level):
        if cls._logging_setup:
            return

        logger = logging.getLogger()
        logger.setLevel(level)

        ch = logging.StreamHandler()
        ch.setLevel(level)
        formatter = logging.Formatter("%(message)s")
        ch.setFormatter(formatter)

        logger.addHandler(ch)

        cls._logging_setup = True


Logging.setup_logging(logging.INFO)

test_data = TestData(__file__)