forked from xamarin/GoogleApisForiOSComponents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensions.cs
More file actions
37 lines (29 loc) · 1.02 KB
/
Extensions.cs
File metadata and controls
37 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using ObjCRuntime;
namespace Firebase.Crashlytics {
public partial class Crashlytics {
public void LogCallerInformation (string message, string className = "", [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "", [CallerLineNumber] int lineNumber = 0)
{
var logBuilder = new StringBuilder ();
if (!string.IsNullOrWhiteSpace (filePath)) {
var filename = Path.GetFileName (filePath);
logBuilder.Append ($"{filename}: ");
}
var isMemberNameEmpty = string.IsNullOrWhiteSpace (memberName);
if (!string.IsNullOrWhiteSpace (className)) {
logBuilder.Append ($"{className}");
logBuilder.Append (isMemberNameEmpty ? " " : ".");
}
if (!isMemberNameEmpty)
logBuilder.Append ($"{memberName} ");
if (lineNumber > 0)
logBuilder.Append ($"line {lineNumber} ");
logBuilder.Append ($"$ {message}");
Log (logBuilder.ToString ());
}
}
}