Closed KellerLiptrap closed 11 months ago
Hello @KellerLiptrap can you please write a description for this PR?
When you run chasten log
, chasten opens up a websocket server on 127.0.0.1:2525
(See chasten/server.py
). This then implements a handler callback that prints messages to the console and logs them to the file .discover.log
:
# server.py
class SyslogUDPHandler(socketserver.BaseRequestHandler):
"""Syslog UDP handler for receiving debugging messages."""
def handle(self):
"""Receive a message and then display it in output and log it to a file."""
global logger # noqa: disable=PLW0603
# receive the message from the syslog logging client
message = bytes.decode(
self.request[0].strip(), encoding=constants.server.Utf8_Encoding
)
# remove not-printable characters that can appear in message
enhanced_message = str(message).replace(
constants.markers.Bad_Fifteen, constants.markers.Empty_String
)
enhanced_message = enhanced_message.replace(
constants.markers.Bad_Zero_Zero, constants.markers.Empty_String
)
# display the message inside of the syslog's console
output.console.print(enhanced_message)
# write the logging message to a file using a rotating file handler
logger.debug(enhanced_message)
You can learn more about this by reading the source code.
I'm not completely sure about the whole intended functionality of this, but I would assume that, depending on the log level specified, the separate syslog process would pick up on this. Does anyone else have any more ideas as to how this works? I've only looked at it for a few minutes.
@KellerLiptrap Did you resolve the issue that Simon pointed out? If so, we can check that as resolved and add this to the list of PRs we can merge by Tuesday.
@boulais01 Yes I have resolved these issues and updated this issue and added to the documentation. I believe that it can be added to the list to be merged.
@KellerLiptrap If this PR is ready for review, make sure to add the label ready-for-review
. Also, please ensure that you are working with the most up-to-date version of chasten
.
@gkapfham, this is priority 4
Hello @KellerLiptrap, can you ensure that this PR is up to date with the main branch? From there we can get this merged
@laurennevill @jnormile I believe the issues you both brought up should be resolved now, if you wouldn't mind reviewing again.
@laurennevill this is ready to be merged when you deem it fit.
Addition of Chasten Log command documentation to the read me.