FileLoggingSession.CloseAndSaveToFileAsync FileLoggingSession.CloseAndSaveToFileAsync FileLoggingSession.CloseAndSaveToFileAsync FileLoggingSession.CloseAndSaveToFileAsync FileLoggingSession.CloseAndSaveToFileAsync Method

Definition

Ends the current logging session and saves it to a file.

public : IAsyncOperation<StorageFile> CloseAndSaveToFileAsync()
IAsyncOperation<StorageFile> CloseAndSaveToFileAsync() const;
public IAsyncOperation<StorageFile> CloseAndSaveToFileAsync()
Public Function CloseAndSaveToFileAsync() As IAsyncOperation(Of StorageFile)
Windows.Foundation.Diagnostics.FileLoggingSession.closeAndSaveToFileAsync().done( /* Your success and error handlers */ );

Returns

When this method completes, it returns the new file as a StorageFile. Returns NULL if there are no events in the session or if logging has just rolled over into a new file that doesn't contain events yet.

Remarks

FileLoggingSession.CloseAndSaveToFileAsync closes the current logging session. If there is a handler for the LogFileGenerated method, and it has been called but not returned, the function waits for the handler to return. If there is any data in the current log file that has not already been reported with the LogFileGenerated event, the function returns a StorageFile representing that file.

Otherwise, the function returns NULL. This can happen if the current log file is empty, or if all log files have already been reported via the LogFileGenerated event. Note that CloseAndSaveToFileAsync might return NULL even if data was recorded and even if there is no LogFileGenerated event. This can happen if the log file became full and was closed, and a new log file was opened immediately before CloseAndSaveToFileAsync was called.

This function is equivalent to FileLoggingSession.Close.