using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tool
{
    public class Log:Singleton<Log>
    {

        private Log()
        {
        }
        public void LogInit()
        {
            LogManager.Instance.LogManagerInit();

        }
        /// <summary>
        /// 写文件类型
        /// </summary>
        /// <param name="logType"></param>
        /// <param name="logFile"></param>
        /// <param name="msg"></param>
        public  void WriteLog(LogType logType, LogFile logFile, string msg)
        {
            try
            {
                LogManager.Instance.WriteLog(logType, logFile, msg);
            }
            catch
            {

            }
        }
        /// <summary>
        /// 文件类型为null
        /// </summary>
        /// <param name="logType"></param>
        /// <param name="msg"></param>
        public  void WriteLog(LogType logType, string msg)
        {
            try
            {
                LogManager.Instance.WriteLog(logType, string.Empty, msg);
            }
            catch
            {

            }
        }
        /// <summary>
        /// 数据库异常的标志位
        /// 0表示update，1表示insert
        /// </summary>
        /// <param name="logType"></param>
        /// <param name="status"></param>
        /// <param name="msg"></param>
        public  void WriteLog(LogType logType, string status, string msg)
        {
            try
            {
                LogManager.Instance.WriteLog(logType, status, msg);
            }
            catch
            {

            }
        }
        /// <summary>
        /// 读日志文件
        /// </summary>
        /// <param name="sqlStatus"></param>
        /// <param name="sqlMsg"></param>
        /// <param name="count"></param>      
        public  List<string> ReadLog()
        {
            List<string> digitList = null;
            try
            {
                digitList = LogManager.Instance.ReadLog();
            }
            catch { }
            return digitList;
        }

        public  void WriteCredence(string msg)
        {
            try
            {
                LogManager.Instance.WriteCredence(msg);
            }
            catch { }
        }
    }
}
