Пример #1
0
        public static void Log(string text, LogLevel level = LogLevel.Info)
        {
            var fechahora    = $"{DateTime.Now.ToString("yyyyMMdd HH:mm:ss")} [{level.GetDescripcion()}] :: ";
            var tab          = new string(' ', fechahora.Length);
            var formatedText = fechahora + text.Replace(Environment.NewLine, Environment.NewLine + tab);

            if (MainForm != null)
            {
                MainForm.GetType().GetMethod("Log", new Type[] { typeof(string) }).Invoke(MainForm, new object[] { formatedText });
            }
            //MainForm.Log(formatedText);
            Logger.Info(formatedText);
        }