Skip to content

Commit

Permalink
fix: log attributes method is throwing expection in android
Browse files Browse the repository at this point in the history
  • Loading branch information
ndesai-newrelic committed Sep 30, 2024
1 parent 32e7a60 commit 5b9d3be
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 1.4.1


## Improvements

- Native Android agent updated to version 7.6.0
- Native iOS agent updated to version 7.5.2
- Bug fixes for Log Attributes method

## 1.4.0

## New Features
Expand Down
6 changes: 3 additions & 3 deletions com.newrelic.agent/Editor/TestUnityDependencies.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<dependencies>
<androidPackages>
<androidPackage spec="com.newrelic.agent.android:agent-ndk:1.+"></androidPackage>
<androidPackage spec="com.newrelic.agent.android:android-agent:7.5.+">
<androidPackage spec="com.newrelic.agent.android:agent-ndk:1.1.2"></androidPackage>
<androidPackage spec="com.newrelic.agent.android:android-agent:7.6.0">
</androidPackage>
</androidPackages>
<iosPods>
<iosPod name="NewRelicAgent" version="~> 7.5.0" minTargetSdk="11.0">
<iosPod name="NewRelicAgent" version="~> 7.5.2" minTargetSdk="11.0">
<sources>
<source>https://github.com/CocoaPods/Specs</source>
</sources>
Expand Down
45 changes: 44 additions & 1 deletion com.newrelic.agent/Scripts/NewRelicAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Threading;
using UnityEngine.SceneManagement;
using System.Collections;
#if UNITY_IPHONE || UNITY_ANDROID
using NewRelic.Native;
#endif
Expand Down Expand Up @@ -749,7 +750,7 @@ static public void NoticeNetworkFailure(string url,
{
if (validatePluginImpl())
{
instance.agentInstance.noticeNetworkFailure(url, httpMethod, startTime,endTime, failureCode, message);
instance.agentInstance.noticeNetworkFailure(url, httpMethod, startTime, endTime, failureCode, message);
}
}

Expand Down Expand Up @@ -1041,10 +1042,13 @@ static public void Log(NewRelicAgent.AgentLogLevel level, String message)
{
if (validatePluginImpl())
{
String logLevel = LogLevelString(level);
instance.agentInstance.Log(level, message);
}
}



/// <summary>
/// Logs a set of attributes.
/// </summary>
Expand All @@ -1053,11 +1057,50 @@ static public void LogAttributes(Dictionary<string, object> attributes)
{
if (validatePluginImpl())
{



if ((attributes.ContainsKey("level") && attributes.GetValueOrDefault("level").GetType() == typeof(AgentLogLevel)))
{
attributes["level"] = LogLevelString((AgentLogLevel)attributes.GetValueOrDefault("level"));
}



instance.agentInstance.LogAttributes(attributes);
}
}


public static String LogLevelString(AgentLogLevel agentLogLevel)
{

String logLevel = "INFO";

if (agentLogLevel.Equals(AgentLogLevel.DEBUG))
{
logLevel = "DEBUG";
}
else if (agentLogLevel.Equals(AgentLogLevel.ERROR))
{
logLevel = "ERROR";
}
else if (agentLogLevel.Equals(AgentLogLevel.INFO))
{
logLevel = "INFO";
}
else if (agentLogLevel.Equals(AgentLogLevel.VERBOSE))
{
logLevel = "VERBOSE";
}
else if (agentLogLevel.Equals(AgentLogLevel.WARNING))
{
logLevel = "WARN";
}



return logLevel;
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.newrelic.agent",
"version": "1.4.0",
"version": "1.4.1",
"displayName": "NewRelic SDK",
"description": "NewRelic's Unity SDK lets you bring the deep, introspective and native debugging power of NewRelic into your Unity game or application.",
"unity": "2019.1",
Expand Down

0 comments on commit 5b9d3be

Please sign in to comment.