Skip to content

Commit 65396a4

Browse files
author
mwatson
committed
Make Logger.ApiKey return the proper key. Added some new comments on our public methods
1 parent 8c84e66 commit 65396a4

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

Dlls/StackifyLib/StackifyLib.dll

0 Bytes
Binary file not shown.

Src/StackifyLib/Internal/Logs/LogClient.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ public string LoggerName
5252

5353
public string APIKey
5454
{
55-
get { return _ApiKey; }
55+
get
56+
{
57+
EnsureHttpClient();
58+
return _HttpClient.APIKey;
59+
}
5660
}
5761

5862
[Obsolete("Use CanQueue instead")]

Src/StackifyLib/Logger.cs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ namespace StackifyLib
1212
public class Logger
1313
{
1414
public static int _MaxLogBufferSize = 10000;
15-
// public static bool AutoSetTransID = false;
16-
15+
1716
private static LogClient _LogClient = null;
1817

1918
static Logger()
@@ -22,11 +21,25 @@ static Logger()
2221
}
2322

2423

25-
24+
/// <summary>
25+
/// Used to override the appname being used by any and all logging appenders. Be it this Logger class, log4net, NLog, etc
26+
/// </summary>
2627
public static string GlobalAppName = null;
28+
29+
/// <summary>
30+
/// Used to override the environment being used by any and all logging appenders. Be it this Logger class, log4net, NLog, etc
31+
/// </summary>
2732
public static string GlobalEnvironment = null;
33+
34+
/// <summary>
35+
/// Used to override the api key being used by any and all logging appenders. Be it this Logger class, log4net, NLog, etc
36+
/// </summary>
2837
public static string GlobalApiKey = null;
2938

39+
40+
/// <summary>
41+
/// Used to get/set the api key used by this logger class, not appenders like log4net, NLog, etc. Set GlobalApiKey to change it for those
42+
/// </summary>
3043
public static string ApiKey
3144
{
3245
get
@@ -45,6 +58,9 @@ public static string ApiKey
4558
}
4659
}
4760

61+
/// <summary>
62+
/// Global setting for any log appenders for how big the log queue size can be in memory before messages are lost if there are problems uploading or we can't upload fast enough
63+
/// </summary>
4864
public static int MaxLogBufferSize
4965
{
5066
get { return _MaxLogBufferSize; }
@@ -59,11 +75,19 @@ public static void Shutdown()
5975
_LogClient.Close();
6076
}
6177

78+
/// <summary>
79+
/// Gets info about the app
80+
/// </summary>
81+
/// <returns></returns>
6282
public static AppIdentityInfo Identity()
6383
{
6484
return _LogClient.GetIdentity();
6585
}
6686

87+
/// <summary>
88+
/// Used to check if there have been recent failures or if the queue is backed up and if logs can be sent or not
89+
/// </summary>
90+
/// <returns></returns>
6791
public static bool CanSend()
6892
{
6993
return _LogClient.CanQueue();
@@ -194,7 +218,11 @@ public static void QueueLogObject(StackifyLib.Models.LogMsg msg, Exception excep
194218
QueueLogObject(msg);
195219
}
196220

197-
221+
/// <summary>
222+
/// Helper method for getting the current stack trace
223+
/// </summary>
224+
/// <param name="declaringClassName"></param>
225+
/// <returns></returns>
198226
public static List<TraceFrame> GetCurrentStackTrace(string declaringClassName)
199227
{
200228
List<TraceFrame> frames = new List<TraceFrame>();

Src/StackifyLib/Utils/HttpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class HttpClient
3434

3535
public string BaseAPIUrl { get; private set; }
3636

37-
private string APIKey
37+
public string APIKey
3838
{
3939
get
4040
{

0 commit comments

Comments
 (0)