Skip to content

v2.1.x Chore - Implement logging when not using tty #233

Closed
1 of 3 issues completed
Closed
@reactive-firewall

Description

@reactive-firewall

Implement improved output via logging module

Introduce the python logging module such that when not invoked from a tty the module logs output such that client code just needs to adjust the logging fixtures to customize verbosity and logging redirection as they see fit.

alternatives considered

  • logging only - less useful; removes interactive features already in-place. 🪚
  • no output - bad for maintainability and not as useful; 🙅🏻

Additional context
also consider:

 try:
     data = data.decode('utf8') if isinstance(data, bytes) else str(data)
 except UnicodeDecodeError:  # pragma: no cover
+    if (_sys.stdout.isatty()):  # pragma: no cover
+        print(f"Debug: Received invalid UTF-8 data from {self.client_address[0]}")
     return  # silently ignore invalid UTF-8 data -- fail quickly.

Sub-issues

Metadata

Metadata

Labels

ChoreMiscellaneous chores to maintain the projectMulticastAny main project file changesPython LangChanges to Python source codeenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions