pylibfreenect2 icon indicating copy to clipboard operation
pylibfreenect2 copied to clipboard

Logging Request

Open gargoyle3333 opened this issue 9 years ago • 2 comments

Hi, this is a feature request - is there a way to convert print statements to use loggers instead? This would allow me to disable output completely or redirect output to a file more easily.

gargoyle3333 avatar May 05 '16 12:05 gargoyle3333

There is no way to do that for now, but it should definitely be possible. Will try to implement if I get a chance.

r9y9 avatar May 05 '16 14:05 r9y9

@gargoyle3333 I implemented logging utilities of libfreenect2. You can change logger level by creating a new logger:

from pylibfreenect2 import createConsoleLogger, setGlobalLogger
from pylibfreenect2 import LoggerLevel

logger = createConsoleLogger(LoggerLevel.Debug)
setGlobalLogger(logger)

To disable,

setGlobalLogger(None)

if you want to replace print statements with libfreenecg2's logger, you can try the following:

logger.log(LoggerLevel.Debug, b"message")

r9y9 avatar May 07 '16 05:05 r9y9