/// <summary> /// This handler is called by the FileLoggingSession instance when a log file reaches a size /// of 256MB. When FileLoggingSession calls this handler, it's effectively giving the /// developer a chance to own the log file. /// </summary> /// <param name="sender"> /// The FileInfoLoggingSession to the this.localFileLogSession which has generated a new file. /// </param> /// <param name="args"> /// The LogFileGeneratedEventArgs instance which contains a StorageFile field /// LogFileGeneratedEventArgs.File representing the new log file. /// </param> private async void LogFileGeneratedHandler(IFileLoggingSession sender, LogFileGeneratedEventArgs args) { LogFileGeneratedCount++; StorageFolder sampleAppDefinedLogFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync( CommonConstants.LogAppLogFolderName, CreationCollisionOption.OpenIfExists); string newLogFileName = string.Format(CultureInfo.CurrentCulture, "{0}-{1}.etl", CommonConstants.LogAppLogFileBaseName, GetTimeStamp()); await args.File.MoveAsync(sampleAppDefinedLogFolder, newLogFileName); // TODO fu why this code exists if (IsPreparingForSuspend == false) { string // newLogFileFullPathName = System.IO.Path.Combine(sampleAppDefinedLogFolder.Path, // newLogFileName); } }
/// <summary> /// This handler is called by the FileLoggingSession instance when a log /// file reaches a size of 256MB. When FileLoggingSession calls this handler, /// it's effectively giving the developer a chance to take ownership of the /// log file. Typically, this handler should move or rename the log file. /// Note that once this handler has returned, the FileLoggingSession is free /// to reuse the original log file name for a new log file at any time. /// </summary> /// <param name="sender">The FileLoggingSession which has generated a new file.</param> /// <param name="args">Contains a StorageFile field LogFileGeneratedEventArgs.File representing the new log file.</param> private async void LogFileGeneratedHandler(IFileLoggingSession sender, LogFileGeneratedEventArgs args) { LogFileGeneratedCount++; StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(LOG_FILE_FOLDER_NAME, CreationCollisionOption.OpenIfExists); string newLogFileName = $"Log-{DateTime.Now.GetTimeStamp()}.etl"; await args.File.MoveAsync(folder, newLogFileName); if (IsPreparingForSuspend == false) { StatusChanged?.Invoke(this, new LoggingScenarioEventArgs(LoggingScenarioEventType.LogFileGenerated, System.IO.Path.Combine(folder.Path, newLogFileName))); } }
private async void LogFileGenerateHandler(IFileLoggingSession sender, LogFileGeneratedEventArgs args) { StorageFolder sampleAppDefinedLogFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(APP_LOG_FILE_FOLDER_NAME, CreationCollisionOption.OpenIfExists); string newLogFileName = "Log-" + GetTimeStamp() + ".etl"; await args.File.MoveAsync(sampleAppDefinedLogFolder, newLogFileName); if (IsPreparingForSuspend == false) { if (StatusChanged != null) { string newLogFileFullPathName = System.IO.Path.Combine(sampleAppDefinedLogFolder.Path, newLogFileName); StatusChanged.Invoke(this, new FileLogEventArgs(FileLogEventType.LogFileGenerated, newLogFileFullPathName)); } } }
/// <summary> /// This handler is called by the FileLoggingSession instance when a log /// file reaches a size of 256MB. When FileLoggingSession calls this handler, /// it's effectively giving the developer a chance to own the log file. /// </summary> /// <param name="sender">The IFileLoggingSession to the session which has generated a new file.</param> /// <param name="args">The LogFileGeneratedEventArgs instance which contains a StorageFile field LogFileGeneratedEventArgs.File representing the new log file.</param> private async void LogFileGeneratedHandler(IFileLoggingSession sender, LogFileGeneratedEventArgs args) { LogFileGeneratedCount++; StorageFolder sampleAppDefinedLogFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(OUR_SAMPLE_APP_LOG_FILE_FOLDER_NAME, CreationCollisionOption.OpenIfExists); string newLogFileName = string.Format("{0}-{1}.etl", LOG_FILE_BASE_FILE_NAME, GetTimeStamp()); await args.File.MoveAsync(sampleAppDefinedLogFolder, newLogFileName); if (IsPreparingForSuspend == false) { if (StatusChanged != null) { string newLogFileFullPathName = System.IO.Path.Combine(sampleAppDefinedLogFolder.Path, newLogFileName); StatusChanged.Invoke(this, new LoggingScenarioEventArgs(LoggingScenarioEventType.LogFileGenerated, newLogFileFullPathName)); } } }
/// <summary> /// This handler is called by the FileLoggingSession instance when a log /// file reaches a size of 256MB. When FileLoggingSession calls this handler, /// it's effectively giving the developer a chance to own the log file. /// </summary> /// <param name="sender">The IFileLoggingSession to the session which has generated a new file.</param> /// <param name="args">The LogFileGeneratedEventArgs instance which contains a StorageFile field LogFileGeneratedEventArgs.File representing the new log file.</param> private async void LogFileGeneratedHandler(IFileLoggingSession sender, LogFileGeneratedEventArgs args) { LogFileGeneratedCount++; StorageFolder sampleAppDefinedLogFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(OUR_SAMPLE_APP_LOG_FILE_FOLDER_NAME, CreationCollisionOption.OpenIfExists); string newLogFileName = string.Format("{0}-{1}.etl", LOG_FILE_BASE_FILE_NAME, GetTimeStamp()); await args.File.MoveAsync(sampleAppDefinedLogFolder, newLogFileName); if (IsPreparingForSuspend == false) { if (StatusChanged != null) { string newLogFileFullPathName = System.IO.Path.Combine(sampleAppDefinedLogFolder.Path, newLogFileName); StatusChanged.Invoke(this, new LoggingScenarioEventArgs(LoggingScenarioEventType.LogFileGenerated, newLogFileFullPathName)); } } }
private void LogFileGeneratedHandler(IFileLoggingSession sender, LogFileGeneratedEventArgs args) { // TODO }