Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Commit 2a2fb44

Browse files
author
Jinserk Baik
committed
using local logger instead of root logger
1 parent dfe0533 commit 2a2fb44

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pysndfx/dsp.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import numpy as np
99

10-
from .sndfiles import FilePathInput, FileBufferInput, NumpyArrayInput, FilePathOutput, NumpyArrayOutput, FileBufferOutput
10+
from .sndfiles import logger, FilePathInput, FileBufferInput, NumpyArrayInput, FilePathOutput, NumpyArrayOutput, FileBufferOutput
1111

1212

1313
def mutually_exclusive(*args):
@@ -123,7 +123,7 @@ def sinc(self,
123123
if left_n is not None:
124124
self.command.append("-n")
125125
self.command.append(str(left_n))
126-
126+
127127
if high_pass_frequency is not None and low_pass_frequency is None:
128128
self.command.append(str(high_pass_frequency))
129129
elif high_pass_frequency is not None and low_pass_frequency is not None:
@@ -408,7 +408,7 @@ def __call__(self,
408408
] + list(map(str, self.command))),
409409
posix=False)
410410

411-
logging.debug("Running command : %s" % cmd)
411+
logger.debug("Running command : %s" % cmd)
412412
if isinstance(stdin, np.ndarray):
413413
stdout, stderr = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate(stdin.tobytes(order="F"))
414414
else:

pysndfx/sndfiles.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
PIPE_CHAR = "-"
1313

14+
logger = logging.getLogger("pysndfx")
1415

1516
class SoxInput(object):
1617
pipe = "-"
@@ -24,7 +25,7 @@ class FilePathInput(SoxInput):
2425
def __init__(self, filepath):
2526
super(FilePathInput, self).__init__()
2627
info_cmd = 'sox --i -c ' + filepath
27-
logging.debug("Running info command : %s" % info_cmd)
28+
logger.debug("Running info command : %s" % info_cmd)
2829
stdout, stderr = Popen(shlex.split(info_cmd, posix=False),
2930
stdout=PIPE,
3031
stderr=PIPE).communicate()
@@ -100,4 +101,4 @@ def __init__(self, encoding, samplerate, channels):
100101
"-r " + str(samplerate),
101102
"-c " + str(channels),
102103
PIPE_CHAR,
103-
])
104+
])

tests/test_dsp.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import logging
55
from pysndfx.dsp import AudioEffectsChain
66

7-
logging.getLogger().setLevel(logging.DEBUG)
7+
logger = logging.getLogger("pysndfx")
8+
logger.setLevel(logging.DEBUG)
89

910
apply_audio_effects = AudioEffectsChain()\
1011
.highshelf()\

0 commit comments

Comments
 (0)