using HslCommunication.LogNet;
using ProjectManagementSystem.Common.Logger;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ProjectManagementSystem.Common.Extenions
{
    public static class LogNetExtenions
    {
        public static void WirteDebugCaller(this ILogNet logNet, string log, [CallerMemberName] string name = null)
        {
            logNet.WriteDebug(name, log);
        }

        public static void WirteInfoCaller(this ILogNet logNet, string log, [CallerMemberName] string name = null)
        {
            logNet.WriteInfo(name, log);
        }

        public static void WriteExceptionCaller(this ILogNet logNet, Exception ex, [CallerMemberName] string name = null)
        {
            logNet.WriteException(name, ex);
        }

        public static void WirteDebugJson(this ILogNet logNet, string log, object data, [CallerMemberName] string name = null)
        {
            logNet.WriteDebug(name, $"{log}{Newtonsoft.Json.JsonConvert.SerializeObject(data)}");
        }

        public static void WirteInfoJson(this ILogNet logNet, string log, object data, [CallerMemberName] string name = null)
        {
            logNet.WriteInfo(name, $"{log}{Newtonsoft.Json.JsonConvert.SerializeObject(data)}");
        }
    }
}
