Skip to content

Commit

Permalink
reword 00fb737 cleared irrelevant code #60 FUCKING EDITED
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirAkopyan committed Nov 10, 2017
1 parent b645cd5 commit 77c031a
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions Quickbird/Services/LoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ public static class LoggingService

static LoggingSession _Session;
private static LoggingChannel _LcDebug;
private static LoggingChannel _LcTrace;

private static UInt64 tracingIndex = 0;
private static TraceEvent[] TracingData = new TraceEvent[200];

/// <summary>
/// LoggingSessionScenario moves generated logs files into the
Expand All @@ -25,18 +21,13 @@ public static class LoggingService

static LoggingService()
{
_LcDebug = new LoggingChannel("QuickbirdUWP_Log",
new LoggingChannelOptions(
new Guid("d3020f82-b5bd-4ead-b739-a2e043d075f3")
));
_LcTrace = new LoggingChannel("QuickbirdUWP_trace",
new LoggingChannelOptions(
new Guid("e4fd6bbb-74de-456a-981e-85314c56c875")
));
_LcDebug = new LoggingChannel(
"QuickbirdUWP_Log",
new LoggingChannelOptions(new Guid("d3020f82-b5bd-4ead-b739-a2e043d075f3"))
);

_Session = new LoggingSession("AppWideSession");
_Session.AddLoggingChannel(_LcDebug);
_Session.AddLoggingChannel(_LcTrace);
}

/// <summary>
Expand All @@ -45,7 +36,8 @@ static LoggingService()
/// <param name="description"></param>
/// <param name="level"></param>
public static void LogInfo(string description, LoggingLevel level, [CallerMemberName]string caller = "Unknown") {
string title = Enum.GetName(typeof(LoggingLevel), level);

string logLevel = Enum.GetName(typeof(LoggingLevel), level);

if (level >= LoggingLevel.Error)
{
Expand All @@ -59,31 +51,32 @@ public static void LogInfo(string description, LoggingLevel level, [CallerMember
LoggingFields fields = new LoggingFields();
fields.AddString("description", description);
fields.AddString("Callermember", caller);
fields.AddDateTime("Timestamp", DateTime.Now);


_LcDebug.LogEvent("Event", fields, level);
_LcDebug.LogEvent(logLevel, fields, level);
}

//Save trace data, will only store last 200 if the app crashes.
public static void Trace(string what, [CallerMemberName]string caller = "Unknown")
//Save trace data, will only store last 200 if the app crashes.
/*public static void Trace(string what, [CallerMemberName]string caller = "Unknown")
{
TraceEvent.AddTrace(what, caller, DateTimeOffset.Now);
}
TraceEvent.AddTrace(what, caller, DateTimeOffset.Now);
}*/


/// <summary>
/// Meant to be called when the app is crashing, will save the log.
/// </summary>
public static void SaveLog()
{
{ /*
var traces = TraceEvent.TraceBuffer;
foreach (var trace in traces)
{
LoggingFields fields = new LoggingFields();
fields.AddString("description", trace.Description);
fields.AddString("Callermember", trace.CallerMember);
fields.AddString("description", trace.Description);
fields.AddDateTime("Timestamp", trace.Timestamp.LocalDateTime);
_LcTrace.LogEvent("TraceEvent", fields);
}
}*/

var saving = Task.Run(SaveLogInMemoryToFileAsync);
saving.Wait();
Expand Down Expand Up @@ -121,11 +114,13 @@ private static string GetTimeStamp()
}



/// <summary>
/// Trace is for unimportant events, which will only be recorded in the event
/// of a crash or something equally dramatic happening. Otherwise they are usually discarded.
/// They jsut register flow of the program.
/// </summary>
/*
private struct TraceEvent
{
private const int _TraceBufferSize = 200;
Expand Down Expand Up @@ -154,6 +149,6 @@ public static void AddTrace(string description, string callerMemberName, DateTim
public string Description;
public DateTimeOffset Timestamp;
public string CallerMember;
}
}*/
}
}

0 comments on commit 77c031a

Please sign in to comment.