@@ -29,11 +29,11 @@ if (platform === "win32") {
2929 } else if ( arch === "x64" ) {
3030 determinedFilename = "yt-dlp" ;
3131 } else {
32- console . warn ( `[WARN] Unsupported Linux architecture '${ arch } ' for yt-dlp. Falling back to generic 'yt-dlp'. Download might fail.` ) ;
32+ logger . warn ( `Unsupported Linux architecture '${ arch } ' for yt-dlp. Falling back to generic 'yt-dlp'. Download might fail.` ) ;
3333 determinedFilename = "yt-dlp" ;
3434 }
3535} else {
36- console . warn ( `[WARN] Unsupported OS '${ platform } ' for yt-dlp. Attempting to use generic 'yt-dlp'. Download might fail.` ) ;
36+ logger . warn ( `Unsupported OS '${ platform } ' for yt-dlp. Attempting to use generic 'yt-dlp'. Download might fail.` ) ;
3737 determinedFilename = "yt-dlp" ;
3838}
3939
@@ -74,7 +74,7 @@ function json(str: string) {
7474
7575export async function downloadExecutable ( ) {
7676 if ( ! existsSync ( exePath ) ) {
77- console . info ( "[INFO] Yt-dlp couldn't be found, trying to download..." ) ;
77+ logger . info ( "Yt-dlp couldn't be found, trying to download..." ) ;
7878 const releases = await got . get ( "https://api.github.com/repos/yt-dlp/yt-dlp/releases?per_page=1" ) . json ( ) ;
7979 const release = releases [ 0 ] ;
8080 const asset = release . assets . find ( ast => ast . name === filename ) ;
@@ -85,7 +85,7 @@ export async function downloadExecutable() {
8585 return 0 ;
8686 } ) . then ( resolve ) . catch ( reject ) ;
8787 } ) ;
88- console . info ( "[INFO] Yt-dlp has been downloaded." ) ;
88+ logger . info ( "Yt-dlp has been downloaded." ) ;
8989 }
9090}
9191
@@ -128,7 +128,7 @@ export default async function ytdl(url: string, options: Partial<YTFlags> = {},
128128 const exitCode = await proc . exited ;
129129
130130 if ( exitCode !== 0 ) {
131- console . error ( `yt-dlp process exited with code ${ exitCode } . Stderr: ${ errorData } ` ) ;
131+ logger . error ( `yt-dlp process exited with code ${ exitCode } . Stderr: ${ errorData } ` ) ;
132132 throw new Error ( `yt-dlp failed with exit code ${ exitCode } : ${ errorData || data } ` ) ;
133133 }
134134
@@ -173,17 +173,17 @@ export async function downloadToTempFile(url: string, options: Partial<YTFlags>
173173 try {
174174 unlinkSync ( tempFilePath ) ;
175175 } catch ( cleanupError ) {
176- console . warn ( `[WARN] Failed to cleanup temp file ${ tempFilePath } after yt-dlp error:` , cleanupError ) ;
176+ logger . warn ( `Failed to cleanup temp file ${ tempFilePath } after yt-dlp error:` , cleanupError ) ;
177177 }
178178 }
179179 const errorMessage = `yt-dlp failed to download to temp file. Exit code: ${ exitCode } . Stderr: ${ errorData . trim ( ) } ` ;
180- console . error ( `[ERROR] ${ errorMessage } ` ) ;
180+ logger . error ( errorMessage ) ;
181181 throw new Error ( errorMessage ) ;
182182 }
183183
184184 if ( ! existsSync ( tempFilePath ) ) {
185185 const errorMessage = `yt-dlp exited successfully but temp file ${ tempFilePath } was not created. Stderr: ${ errorData . trim ( ) } ` ;
186- console . error ( `[ERROR] ${ errorMessage } ` ) ;
186+ logger . error ( errorMessage ) ;
187187 throw new Error ( errorMessage ) ;
188188 }
189189
@@ -192,7 +192,6 @@ export async function downloadToTempFile(url: string, options: Partial<YTFlags>
192192}
193193
194194export async function checkForUpdatesAndUpdate ( ) : Promise < void > {
195- logger . info ( "Checking for yt-dlp updates..." ) ;
196195 try {
197196 await downloadExecutable ( ) ;
198197 const updateProc = spawn ( [ exePath , "--update" ] , {
0 commit comments