Files
dmrlink3/log.py
T
Cort BuffingtonandClaude Sonnet 4.6 ce191c2b34 Initial port: Python 3 / asyncio reimplementation of dmrlink
Full port of dmrlink (Python 2 / Twisted) to Python 3 with asyncio, aligned
with the HBlink3 2026_cleanup branch style.

- const.py:  merged ipsc_const + ipsc_mask, all bytes literals corrected for Py3
- log.py:    root-logger config matching HBlink3 log.py
- config.py: configparser Py3 port; bytes built with bytes([]) / bytes.fromhex()
- dmrlink.py: full asyncio IPSC protocol engine; ReportServer (NDJSON/TCP)
  replaces Twisted DatagramProtocol, LoopingCall, NetstringReceiver, and pickle
- bridge.py: asyncio port of confbridge.py, renamed to match HBlink3 convention;
  BridgeReportServer adds NDJSON bridge/call-event streaming
- dashboard/: FastAPI + WebSocket dashboard adapted for IPSC data shapes
  (MASTER/PEER mode, PEERS dict, bridge_event call log)
- requirements.txt, pyproject.toml: package metadata

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 12:41:31 -05:00

83 lines
2.9 KiB
Python

#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2026 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
import logging
from logging.config import dictConfig
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2026 Cortney T. Buffington, N0MJS and the K0USY Group'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
def config_logging(_logger):
dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'timed': {
'format': '%(levelname)s %(asctime)s %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
'syslog': {
'format': '%(name)s (%(process)d): %(levelname)s %(message)s'
}
},
'handlers': {
'null': {
'class': 'logging.NullHandler'
},
'console': {
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'console-timed': {
'class': 'logging.StreamHandler',
'formatter': 'timed'
},
'file': {
'class': 'logging.FileHandler',
'formatter': 'simple',
'filename': _logger['LOG_FILE'],
},
'file-timed': {
'class': 'logging.FileHandler',
'formatter': 'timed',
'filename': _logger['LOG_FILE'],
},
'syslog': {
'class': 'logging.handlers.SysLogHandler',
'formatter': 'syslog',
}
},
'root': {
'handlers': _logger['LOG_HANDLERS'].split(','),
'level': _logger['LOG_LEVEL'],
'propagate': True,
},
})
return logging.getLogger(_logger['LOG_NAME'])