package utils

import (
	"dashboard/logger"
	"dashboard/models"

	"github.com/gin-gonic/gin"
)

func GetLogFromContext(c *gin.Context) (*logger.Logger, error) {
	res, ok := c.Get(models.GinContxtLog)
	if !ok {
		return nil, models.ErrorInvalidData
	}

	log, ok := res.(*logger.Logger)
	if !ok {
		return nil, models.ErrorInvalidData
	}

	return log, nil
}
