Coverage for middlelayer / ngect / __init__.py: 100.00%

21 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-16 06:04 +0000

1# Copyright 2023 Associated Universities, Inc. 

2# 

3# This file is part of ngVLA Exposure Calculator Tool (ngECT). 

4# 

5# ngECT is free software: you can redistribute it and/or modify 

6# it under the terms of the GNU General Public License as published by 

7# the Free Software Foundation, either version 3 of the License, or 

8# any later version. 

9# 

10# ngECT is distributed in the hope that it will be useful, 

11# but WITHOUT ANY WARRANTY; without even the implied warranty of 

12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

13# GNU General Public License for more details. 

14# 

15# You should have received a copy of the GNU General Public License 

16# along with ngECT. If not, see <https://www.gnu.org/licenses/>. 

17 

18"""Top-level package for ngECT.""" 

19 

20import logging 

21import os 

22 

23from .utils import check_dir 

24 

25__author__ = """Rui Xue""" 

26__email__ = "rxue@nrao.edu" 

27__version__ = "0.0.4" 

28__logfile__ = os.getenv("NGECT_LOG", default="ngect.log") 

29 

30# initialize the package logger 

31 

32logger = logging.getLogger("ngect") 

33logger.handlers = [] 

34logger.setLevel(logging.DEBUG) 

35 

36__formatter__ = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s : %(message)s") 

37 

38console_handler = logging.StreamHandler() 

39console_handler.setFormatter(__formatter__) 

40console_handler.setLevel("INFO") 

41logger.addHandler(console_handler) 

42 

43_ = check_dir(__logfile__) 

44logfile_handler = logging.FileHandler(__logfile__, mode="a") 

45logfile_handler.setFormatter(__formatter__) 

46logfile_handler.setLevel("DEBUG") 

47logger.addHandler(logfile_handler) 

48 

49# import the app at the last to avoid circular importing 

50from .api import app