/**
 * 日志服务代理
 * 从 Framework 获取 logsService
 */

const Framework = require('../framework/node-core-framework.js');

// 控制台日志备用方案
const consoleLogs = {
  log: (message, level = 'info') => console.log(`[${level.toUpperCase()}] ${message}`),
  error: (message) => console.error(`[ERROR] ${message}`),
  warn: (message) => console.warn(`[WARN] ${message}`)
};

module.exports = new Proxy({}, {
  get(_, prop) {
    const services = Framework.getServices();
    const logsService = services?.logsService || consoleLogs;
    
    return typeof logsService[prop] === 'function' 
      ? logsService[prop].bind(logsService)
      : logsService[prop];
  }
});

