Dela via


FileLoggingSession.CloseAndSaveToFileAsync Method

Definition

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

public:
 virtual IAsyncOperation<StorageFile ^> ^ CloseAndSaveToFileAsync() = CloseAndSaveToFileAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageFile> CloseAndSaveToFileAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageFile> CloseAndSaveToFileAsync();
function closeAndSaveToFileAsync()
Public Function CloseAndSaveToFileAsync () As IAsyncOperation(Of StorageFile)

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.

Implements

Attributes

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.

Applies to