You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I just found this project, and I love the approach it takes to logging - in particular the idea of building instrumentation in from the design stage. But there's one thing I can't see how to handle, which is to integrate "unstructured" output into the logs.
To give an example, in pip[1] we build a project by calling the build system in a subprocess. So in a lithoxyl style of code, we'd do something like (highly simplified, obviously):
defbuild_project(proj):
withlog.critical("Extracting sources"):
build_dir=get_temp_location()
proj.extract_source_to(build_dir)
withlog.critical("Building project"):
proc=subprocess.run([sys.executable, 'setup.py', 'bdist_wheel'], capture_output=True)
# subprocess output is in proc.output
However, we capture the output of the subprocess, and we want to display it only when there's an error. Ideally, output would be something like:
... Extracting sources succeeded
... Building project failed
subprocess output goes here
with whatever formatting the build process used
preserved
intact
for the user to diagnose the issue
Note that I don't really want things like timestamps on the subprocess output, as that makes no sense (we didn't log the output in "real time" so the timestamps would be misleading rather than helpful).
Alternatively, there are cases where I'd log the subprocess output in real time. In those cases, I'd be OK with timestamp-style data, but conversely I'd want the display of the data to be tied to the success or failure of the enclosing action, so the output is only displayed if the build action doesn't succeed (which is obviously complicated by the fact that the output has been generated before we know whether we're going to want to display it).
Is there a way to do this?
[1] BTW, there's no plan that I know of to switch to using lithoxyl with pip, but it's a good example of the type of problem I face frequently.
The text was updated successfully, but these errors were encountered:
Hi, I just found this project, and I love the approach it takes to logging - in particular the idea of building instrumentation in from the design stage. But there's one thing I can't see how to handle, which is to integrate "unstructured" output into the logs.
To give an example, in pip[1] we build a project by calling the build system in a subprocess. So in a lithoxyl style of code, we'd do something like (highly simplified, obviously):
However, we capture the output of the subprocess, and we want to display it only when there's an error. Ideally, output would be something like:
Note that I don't really want things like timestamps on the subprocess output, as that makes no sense (we didn't log the output in "real time" so the timestamps would be misleading rather than helpful).
Alternatively, there are cases where I'd log the subprocess output in real time. In those cases, I'd be OK with timestamp-style data, but conversely I'd want the display of the data to be tied to the success or failure of the enclosing action, so the output is only displayed if the build action doesn't succeed (which is obviously complicated by the fact that the output has been generated before we know whether we're going to want to display it).
Is there a way to do this?
[1] BTW, there's no plan that I know of to switch to using lithoxyl with pip, but it's a good example of the type of problem I face frequently.
The text was updated successfully, but these errors were encountered: