private TraceLog ( |
||
ex | ||
message | string | |
reportIt | bool | |
filePath | [ | |
lineNumber | [ | |
method | [ | |
return | void |
public static void TraceLog(Exception ex, string message, bool reportIt = true, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberNameAttribute] string method = "")
{
if (LogLevel > eTraceType.Info)
return;
#if DEBUG
try { var p = Path.GetFileName(filePath); } catch { Debug.Assert(false, "Invalid Log message"); };
#endif
//two spaces after info not a typo
while (ex != null)
{
var stack = ex.StackTrace;
#if NETFX
try { Trace.WriteLine(String.Format("{0} Info {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message + " (" + ex.Message + ")" + Environment.NewLine + "StackTrace : " + stack)); } catch { }
#elif UNIVERSAL
try { Debug.WriteLine(String.Format("{0} Info {1} [{2}:{3}] :: {4}", DateTime.Now, Path.GetFileName(filePath), method, lineNumber, message + " (" + ex.Message + ")" + Environment.NewLine + "StackTrace : " + stack)); } catch { }
#endif
ex = ex.InnerException;
}
}
DebugEx::TraceLog ( string message, [ filePath = "", [ lineNumber, [ method = "" ) : void |
private static YConfig <T> Retrieve(string filename, Func <string, string> PreProccessContent = null) { if (string.IsNullOrWhiteSpace(filename)) { return(null); } try { //Read in configuration array from file pointed to by input param (or falling back to default file) #if NETFX var content = File.ReadAllText(filename); #elif UNIVERSAL var ss = new Tools.StorageService(false); var content = ss.LoadFile(filename).GetResults(); #endif if (PreProccessContent != null) { content = PreProccessContent(content); } //deserialize into List of Configurations and pick the active one return(content.FromJSON <YConfig <T> >()); } catch (Exception ex) { DebugEx.TraceLog("Failed to read config file : " + ex.Message); return(null); } }