diff --git a/com.newrelic.agent/Scripts/Native/NewRelicAndroid.cs b/com.newrelic.agent/Scripts/Native/NewRelicAndroid.cs index 09c2f09..fed3096 100644 --- a/com.newrelic.agent/Scripts/Native/NewRelicAndroid.cs +++ b/com.newrelic.agent/Scripts/Native/NewRelicAndroid.cs @@ -4,6 +4,7 @@ using System.Text.RegularExpressions; using NewRelic.Utilities; using UnityEngine; +using static NewRelic.NewRelicAgent; namespace NewRelic.Native { @@ -564,8 +565,8 @@ public static void logMessageHandler(string logString, string stackTrace, LogTyp if (pluginInstance != null) { Dictionary attributes = new Dictionary(); - attributes.Add("level", type.ToString()); - attributes.Add("log", logString); + attributes.Add("level", ConvertUnityLogTypesToNewRelicLogType(type)); + attributes.Add("message", logString); if (stackTrace.Length > 0) { attributes.Add("stacktrace", stackTrace); @@ -785,7 +786,32 @@ public override void LogAttributes(Dictionary attributes) AndroidJavaObject javaMap = CreateJavaMapFromDictionary(attributes); pluginInstance.CallStatic("logAttributes", javaMap); } + + static String ConvertUnityLogTypesToNewRelicLogType(LogType type) + { + String logLevel = "INFO"; + + if (type.Equals(LogType.Assert)) + { + logLevel = "VERBOSE"; + }else if (type.Equals(LogType.Log)) + { + logLevel = "INFO"; + } + else if (type.Equals(LogType.Warning)) + { + logLevel = "WARN"; + } + else if (type.Equals(LogType.Error)) + { + logLevel = "ERROR"; + } + + return logLevel; + } } + + } #endif \ No newline at end of file diff --git a/com.newrelic.agent/Scripts/Native/NewRelicIos.cs b/com.newrelic.agent/Scripts/Native/NewRelicIos.cs index e29f510..0b55622 100644 --- a/com.newrelic.agent/Scripts/Native/NewRelicIos.cs +++ b/com.newrelic.agent/Scripts/Native/NewRelicIos.cs @@ -621,9 +621,9 @@ public static void logMessageHandler(string logString, string stackTrace, LogTyp var attributes = NR_dictionaryCreate(); - NR_dictionaryInsertString(attributes, "log", logString); + NR_dictionaryInsertString(attributes, "message", logString); NR_dictionaryInsertString(attributes, "stacktrace", stackTrace); - NR_dictionaryInsertString(attributes, "logLevel", type.ToString()); + NR_dictionaryInsertString(attributes, "logLevel", ConvertUnityLogTypesToNewRelicLogType(type)); NR_logAttributes(attributes); @@ -784,6 +784,29 @@ public override void LogAttributes(Dictionary attributes) System.IntPtr NSDict = CreateNSDictionaryFromDictionary(attributes); NR_logAttributes(NSDict); } + + static String ConvertUnityLogTypesToNewRelicLogType(LogType type) + { + String logLevel = "INFO"; + + if (type.Equals(LogType.Assert)) + { + logLevel = "VERBOSE"; + }else if (type.Equals(LogType.Log)) + { + logLevel = "INFO"; + } + else if (type.Equals(LogType.Warning)) + { + logLevel = "WARN"; + } + else if (type.Equals(LogType.Error)) + { + logLevel = "ERROR"; + } + + return logLevel; + } } internal class StackFrame