Exemplo n.º 1
0
        public static void Log(LogLevelFlags logLevel, IDictionary <string, string> fields)
        {
            var fields_ = new LogField[fields.Count];
            int i       = 0;

            foreach (var item in fields)
            {
                fields_[i].Key    = GMarshal.StringToUtf8Ptr(item.Key);
                fields_[i].Value  = GMarshal.StringToUtf8Ptr(item.Value);
                fields_[i].Length = new IntPtr(-1);
                i++;
            }
            g_log_structured_array(logLevel, fields_, (UIntPtr)fields_.Length);
            foreach (var item in fields_)
            {
                GMarshal.Free(item.Key);
                GMarshal.Free(item.Value);
            }
        }