logging 모듈

class ufp.logging.StreamLogger(level, logger=None)

Bases: io.IOBase

주어진 로깅 객체에 파일 처럼 쓸수 있는 객체를 생성합니다.

예컨데, 다음과 같이 활용 할 수 있습니다.

>>> import ufp.logging
>>> import subprocess
>>> import logging
>>> logging.setLevel(logging.DEBUG)
>>> with ufp.logging.StreamLogger(logging.INFO) as out:
...     with ufp.logging.StreamLogger(logging.ERROR) as err:
...             subprocess.call(['ls', '-1'], stdout=out, stderr=err)
... 
...     
INFO:root:test (d1).file
INFO:root:test (d2).file
INFO:root:test.file
0
매개 변수:
  • logger (logging.Logger, None) – 로깅 객체. 생략시 전역 로깅 객체를 사용합니다.
  • level (int) – 로그 작성 레벨
close()

스트림을 닫습니다.

fileno()

이 스트림의 fileno를 반환합니다.

반환:이 스트림의 파일 디스크립터
반환 형식:int
write(data)

스트림에 메세지를 작성합니다.

매개 변수:data – 데이터.