Enhance docker logging for debugging (Python unbuffered, GORM logger, yt-dlp debug wrapper)
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -106,10 +106,13 @@ func DownloadMedia(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
cmd := exec.Command("python", args...)
|
||||
fmt.Printf("[DEBUG Go Exec] Command: %v\n", cmd.String())
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
fmt.Printf("[DEBUG Go Exec] Output:\n%s\n", string(output))
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Download error:", string(output))
|
||||
fmt.Printf("[DEBUG Go Exec] Download error: %v\n", string(output))
|
||||
BroadcastProgress("Error: " + err.Error())
|
||||
models.DB.Create(&models.MediaHistory{
|
||||
SourceURL: req.URL,
|
||||
|
||||
@@ -2,9 +2,11 @@ package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
)
|
||||
|
||||
var DB *gorm.DB
|
||||
@@ -19,8 +21,20 @@ type MediaHistory struct {
|
||||
|
||||
func InitDB(dbPath string) {
|
||||
var err error
|
||||
|
||||
// 도커 로그 디버깅을 위해 SQL 쿼리를 디테일하게 출력하는 로거 설정
|
||||
newLogger := logger.New(
|
||||
log.New(os.Stdout, "\r\n", log.LstdFlags),
|
||||
logger.Config{
|
||||
LogLevel: logger.Info,
|
||||
Colorful: true,
|
||||
},
|
||||
)
|
||||
|
||||
log.Println("Connecting to SQLite at:", dbPath)
|
||||
DB, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
||||
DB, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{
|
||||
Logger: newLogger,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal("Failed to connect to database:", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user