aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils/_utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-07-15 11:41:08 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-07-15 16:18:34 +0530
commit1b392f905d20ef1f1b300b180f867d43c9ce49b8 (patch)
tree06fb8578404d5775e8be103dfef1a111521c2745 /yt_dlp/utils/_utils.py
parent1ba6fe9db5f660d5538588315c23ad6cf0371c5f (diff)
downloadhypervideo-pre-1b392f905d20ef1f1b300b180f867d43c9ce49b8.tar.lz
hypervideo-pre-1b392f905d20ef1f1b300b180f867d43c9ce49b8.tar.xz
hypervideo-pre-1b392f905d20ef1f1b300b180f867d43c9ce49b8.zip
[utils] Add temporary shim for logging
Related: #5680, #7517
Diffstat (limited to 'yt_dlp/utils/_utils.py')
-rw-r--r--yt_dlp/utils/_utils.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py
index 3023c33b2..4af955743 100644
--- a/yt_dlp/utils/_utils.py
+++ b/yt_dlp/utils/_utils.py
@@ -5994,3 +5994,33 @@ class FormatSorter:
format['tbr'] = try_call(lambda: format['vbr'] + format['abr']) or None
return tuple(self._calculate_field_preference(format, field) for field in self._order)
+
+
+# XXX: Temporary
+class _YDLLogger:
+ def __init__(self, ydl=None):
+ self._ydl = ydl
+
+ def debug(self, message):
+ if self._ydl:
+ self._ydl.write_debug(message)
+
+ def info(self, message):
+ if self._ydl:
+ self._ydl.to_screen(message)
+
+ def warning(self, message, *, once=False):
+ if self._ydl:
+ self._ydl.report_warning(message, only_once=once)
+
+ def error(self, message, *, is_error=True):
+ if self._ydl:
+ self._ydl.report_error(message, is_error=is_error)
+
+ def stdout(self, message):
+ if self._ydl:
+ self._ydl.to_stdout(message)
+
+ def stderr(self, message):
+ if self._ydl:
+ self._ydl.to_stderr(message)