public static Action <LogData, string> CreateWSSharpProxyLoggerOutput(UnityEngine.ILogger logger)
        {
            const string tag = "WebSocket";

            return((data, s) =>
            {
                switch (data.Level)
                {
                case LogLevel.Trace:
                case LogLevel.Debug:
                case LogLevel.Info:
                    logger.Log(tag, data.Message);
                    break;

                case LogLevel.Warn:
                    logger.LogWarning(tag, data.Message);
                    break;

                case LogLevel.Error:
                case LogLevel.Fatal:
                    logger.LogError(tag, data.Message);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            });
        }
        static StackObject *LogWarning_15(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Object @context = (UnityEngine.Object) typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Object @message = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.String @tag = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            UnityEngine.ILogger instance_of_this_method = (UnityEngine.ILogger) typeof(UnityEngine.ILogger).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.LogWarning(@tag, @message, @context);

            return(__ret);
        }
Exemple #3
0
 public void Warn(string message, params object[] args)
 {
     if (LogLevel >= LogLevel.Warn)
     {
         var formatted = string.Format(message, args);
         _unityLogger.LogWarning(formatted, formatted);
     }
 }
Exemple #4
0
 static public int LogWarning(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 3)
         {
             UnityEngine.ILogger self = (UnityEngine.ILogger)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Object a2;
             checkType(l, 3, out a2);
             self.LogWarning(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             UnityEngine.ILogger self = (UnityEngine.ILogger)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Object a2;
             checkType(l, 3, out a2);
             UnityEngine.Object a3;
             checkType(l, 4, out a3);
             self.LogWarning(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function LogWarning to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemple #5
0
        static int _m_LogWarning(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ILogger __cl_gen_to_be_invoked = (UnityEngine.ILogger)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <object>(L, 3))
                {
                    string tag     = LuaAPI.lua_tostring(L, 2);
                    object message = translator.GetObject(L, 3, typeof(object));

                    __cl_gen_to_be_invoked.LogWarning(tag, message);



                    return(0);
                }
                if (__gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <object>(L, 3) && translator.Assignable <UnityEngine.Object>(L, 4))
                {
                    string             tag     = LuaAPI.lua_tostring(L, 2);
                    object             message = translator.GetObject(L, 3, typeof(object));
                    UnityEngine.Object context = (UnityEngine.Object)translator.GetObject(L, 4, typeof(UnityEngine.Object));

                    __cl_gen_to_be_invoked.LogWarning(tag, message, context);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ILogger.LogWarning!"));
        }
 static public int LogWarning(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 3)
         {
             UnityEngine.ILogger self = (UnityEngine.ILogger)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Object a2;
             checkType(l, 3, out a2);
             self.LogWarning(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             UnityEngine.ILogger self = (UnityEngine.ILogger)checkSelf(l);
             System.String       a1;
             checkType(l, 2, out a1);
             System.Object a2;
             checkType(l, 3, out a2);
             UnityEngine.Object a3;
             checkType(l, 4, out a3);
             self.LogWarning(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function LogWarning to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }