Skip to content

Instantly share code, notes, and snippets.

View bendikwa's full-sized avatar

Bendik Wang Andreassen bendikwa

View GitHub Profile
@bendikwa
bendikwa / logging_subprocess.py
Created February 3, 2017 06:21 — forked from bgreenlee/logging_subprocess.py
Variant of subprocess.call that accepts a logger instead of stdout/stderr #python
import subprocess
import select
from logging import DEBUG, ERROR
def call(popenargs, logger, stdout_log_level=DEBUG, stderr_log_level=ERROR, **kwargs):
"""
Variant of subprocess.call that accepts a logger instead of stdout/stderr,
and logs stdout messages via logger.debug and stderr messages via
logger.error.

Keybase proof

I hereby claim:

  • I am bendikwa on github.
  • I am bendikwa (https://keybase.io/bendikwa) on keybase.
  • I have a public key ASAvxKkVFQbbIUqYUXvQN7OEunlwZ_0I522i0SRFKJAMIAo

To claim this, I am signing this object: