MCPcopy Create free account
hub / github.com/Audio-AGI/AudioSep / create_logging

Function create_logging

utils.py:26–49  ·  view source on GitHub ↗
(log_dir, filemode)

Source from the content-addressed store, hash-verified

24
25
26def create_logging(log_dir, filemode):
27 os.makedirs(log_dir, exist_ok=True)
28 i1 = 0
29
30 while os.path.isfile(os.path.join(log_dir, "{:04d}.log".format(i1))):
31 i1 += 1
32
33 log_path = os.path.join(log_dir, "{:04d}.log".format(i1))
34 logging.basicConfig(
35 level=logging.DEBUG,
36 format="%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s",
37 datefmt="%a, %d %b %Y %H:%M:%S",
38 filename=log_path,
39 filemode=filemode,
40 )
41
42 # Print to console
43 console = logging.StreamHandler()
44 console.setLevel(logging.INFO)
45 formatter = logging.Formatter("%(name)-12s: %(levelname)-8s %(message)s")
46 console.setFormatter(formatter)
47 logging.getLogger("").addHandler(console)
48
49 return logging
50
51
52def float32_to_int16(x: float) -> int:

Callers 1

get_dirsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected