using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using Windows.Storage;

namespace ZKuP
{
    class Log
    {
        public static async Task WriteLog(string Message)
        {
#if DEBUG
            Debug.WriteLine(Message);
#endif

            await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.errorLog (User, TimeStamp, Message) VALUES (@user, @timestamp, @message)", new List<MySqlParameter>()
            {
                new MySqlParameter("@user", Environment.UserName),
                new MySqlParameter("@timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                new MySqlParameter("@message", Message)
            });
        }
    }
}
