Skip to content

Commit

Permalink
Revert logger name
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Dec 7, 2024
1 parent 9038aaa commit d2f94f4
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 101 deletions.
8 changes: 4 additions & 4 deletions Snowflake.Data/Core/Authenticator/IAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private SFRestRequest BuildLoginRequest()
/// </summary>
internal class AuthenticatorFactory
{
private static readonly SFLogger s_logger = SFLoggerFactory.GetLogger<AuthenticatorFactory>();
private static readonly SFLogger logger = SFLoggerFactory.GetLogger<AuthenticatorFactory>();
/// <summary>
/// Generate the authenticator given the session
/// </summary>
Expand Down Expand Up @@ -164,7 +164,7 @@ internal static IAuthenticator GetAuthenticator(SFSession session)
var error = new SnowflakeDbException(
SFError.INVALID_CONNECTION_STRING,
new object[] { invalidStringDetail });
s_logger.Error(error.Message, error);
logger.Error(error.Message, error);
throw error;
}

Expand All @@ -181,7 +181,7 @@ internal static IAuthenticator GetAuthenticator(SFSession session)
var error = new SnowflakeDbException(
SFError.INVALID_CONNECTION_STRING,
new object[] { invalidStringDetail });
s_logger.Error(error.Message, error);
logger.Error(error.Message, error);
throw error;
}

Expand All @@ -192,7 +192,7 @@ internal static IAuthenticator GetAuthenticator(SFSession session)
{
return new OktaAuthenticator(session, type);
}
s_logger.Error($"Unknown authenticator {type}");
logger.Error($"Unknown authenticator {type}");
throw new SnowflakeDbException(SFError.UNKNOWN_AUTHENTICATOR, type);
}
}
Expand Down
1 change: 0 additions & 1 deletion Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using Org.BouncyCastle.X509;
using System.Security.Claims;
using Microsoft.IdentityModel.Tokens;

namespace Snowflake.Data.Core.Authenticator
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Core/ChunkDownloaderFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2012-2019 Snowflake Computing Inc. All rights reserved.
*/

Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Core/ChunkParserFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2012-2019 Snowflake Computing Inc. All rights reserved.
*/

Expand Down
8 changes: 4 additions & 4 deletions Snowflake.Data/Core/FastParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ namespace Snowflake.Data.Core
{
public class FastParser
{
private static readonly SFLogger s_logger = SFLoggerFactory.GetLogger<FastParser>();
private static readonly SFLogger Logger = SFLoggerFactory.GetLogger<FastParser>();

public static Int64 FastParseInt64(byte[] s, int offset, int len)
{
if (s == null)
{
Exception ex = new SnowflakeDbException(SFError.INTERNAL_ERROR, $"Cannot parse a null buffer");
s_logger.Error("A null buffer was passed to FastParseInt64", ex);
Logger.Error("A null buffer was passed to FastParseInt64", ex);
throw ex;
}

Expand Down Expand Up @@ -54,7 +54,7 @@ public static Int32 FastParseInt32(byte[] s, int offset, int len)
if (s == null)
{
Exception ex = new SnowflakeDbException(SFError.INTERNAL_ERROR, $"Cannot parse a null buffer");
s_logger.Error("A null buffer was passed to FastParseInt32", ex);
Logger.Error("A null buffer was passed to FastParseInt32", ex);
throw ex;
}

Expand Down Expand Up @@ -95,7 +95,7 @@ public static decimal FastParseDecimal(byte[] s, int offset, int len)
if (s == null)
{
Exception ex = new SnowflakeDbException(SFError.INTERNAL_ERROR, $"Cannot parse a null buffer");
s_logger.Error("A null buffer was passed to FastParseDecimal", ex);
Logger.Error("A null buffer was passed to FastParseDecimal", ex);
throw ex;
}

Expand Down
6 changes: 3 additions & 3 deletions Snowflake.Data/Core/FileTransfer/EncryptionProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2023 Snowflake Computing Inc. All rights reserved.
*/

Expand All @@ -22,7 +22,7 @@ class EncryptionProvider
/// <summary>
/// The logger.
/// </summary>
private static readonly SFLogger s_logger = SFLoggerFactory.GetLogger<EncryptionProvider>();
private static readonly SFLogger Logger = SFLoggerFactory.GetLogger<EncryptionProvider>();

/// <summary>
/// Encrypt data and write to the outStream.
Expand Down Expand Up @@ -60,7 +60,7 @@ public static StreamPair EncryptStream(
{
byte[] decodedMasterKey = Convert.FromBase64String(encryptionMaterial.queryStageMasterKey);
int masterKeySize = decodedMasterKey.Length;
s_logger.Debug($"Master key size : {masterKeySize}");
Logger.Debug($"Master key size : {masterKeySize}");

// Generate file key
byte[] ivData = new byte[blockSize];
Expand Down
58 changes: 29 additions & 29 deletions Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2021 Snowflake Computing Inc. All rights reserved.
*/

Expand Down Expand Up @@ -60,7 +60,7 @@ class SFFileTransferAgent
/// <summary>
/// The logger.
/// </summary>
private static readonly SFLogger s_logger = SFLoggerFactory.GetLogger<SFFileTransferAgent>();
private static readonly SFLogger Logger = SFLoggerFactory.GetLogger<SFFileTransferAgent>();

/// <summary>
/// Auto-detect keyword for source compression type auto detection.
Expand Down Expand Up @@ -230,7 +230,7 @@ public void execute()
}
catch (Exception e)
{
s_logger.Error("Error while transferring file(s): " + e.Message);
Logger.Error("Error while transferring file(s): " + e.Message);
if (e is SnowflakeDbException snowflakeException)
{
if (snowflakeException.QueryId == null)
Expand Down Expand Up @@ -346,19 +346,19 @@ private void upload()
//For each file, using the remote client
if (0 < LargeFilesMetas.Count)
{
s_logger.Debug("Start uploading large files");
Logger.Debug("Start uploading large files");
foreach (SFFileMetadata fileMetadata in LargeFilesMetas)
{
UploadFilesInSequential(fileMetadata);
}
s_logger.Debug("End uploading large files");
Logger.Debug("End uploading large files");
}

if (0 < SmallFilesMetas.Count)
{
s_logger.Debug("Start uploading small files");
Logger.Debug("Start uploading small files");
UploadFilesInParallel(SmallFilesMetas, TransferMetadata.parallel);
s_logger.Debug("End uploading small files");
Logger.Debug("End uploading small files");
}
}

Expand All @@ -372,19 +372,19 @@ private async Task uploadAsync(CancellationToken cancellationToken)
//For each file, using the remote client
if (0 < LargeFilesMetas.Count)
{
s_logger.Debug("Start uploading large files");
Logger.Debug("Start uploading large files");
foreach (SFFileMetadata fileMetadata in LargeFilesMetas)
{
await UploadFilesInSequentialAsync(fileMetadata, cancellationToken).ConfigureAwait(false);
}
s_logger.Debug("End uploading large files");
Logger.Debug("End uploading large files");
}

if (0 < SmallFilesMetas.Count)
{
s_logger.Debug("Start uploading small files");
Logger.Debug("Start uploading small files");
await UploadFilesInParallelAsync(SmallFilesMetas, TransferMetadata.parallel, cancellationToken).ConfigureAwait(false);
s_logger.Debug("End uploading small files");
Logger.Debug("End uploading small files");
}
}

Expand All @@ -399,18 +399,18 @@ private void download()
//For each file, using the remote client
if (0 < LargeFilesMetas.Count)
{
s_logger.Debug("Start uploading large files");
Logger.Debug("Start uploading large files");
foreach (SFFileMetadata fileMetadata in LargeFilesMetas)
{
DownloadFilesInSequential(fileMetadata);
}
s_logger.Debug("End uploading large files");
Logger.Debug("End uploading large files");
}
if (0 < SmallFilesMetas.Count)
{
s_logger.Debug("Start uploading small files");
Logger.Debug("Start uploading small files");
DownloadFilesInParallel(SmallFilesMetas, TransferMetadata.parallel);
s_logger.Debug("End uploading small files");
Logger.Debug("End uploading small files");
}
}

Expand All @@ -424,18 +424,18 @@ private async Task downloadAsync(CancellationToken cancellationToken)
//For each file, using the remote client
if (0 < LargeFilesMetas.Count)
{
s_logger.Debug("Start uploading large files");
Logger.Debug("Start uploading large files");
foreach (SFFileMetadata fileMetadata in LargeFilesMetas)
{
await DownloadFilesInSequentialAsync(fileMetadata, cancellationToken).ConfigureAwait(false);
}
s_logger.Debug("End uploading large files");
Logger.Debug("End uploading large files");
}
if (0 < SmallFilesMetas.Count)
{
s_logger.Debug("Start uploading small files");
Logger.Debug("Start uploading small files");
await DownloadFilesInParallelAsync(SmallFilesMetas, TransferMetadata.parallel, cancellationToken).ConfigureAwait(false);
s_logger.Debug("End uploading small files");
Logger.Debug("End uploading small files");
}
}

Expand Down Expand Up @@ -574,7 +574,7 @@ private void initFileMetadata(
// Auto-detect source compression type
// Will return NONE if no matching type is found
compressionType = SFFileCompressionTypes.GuessCompressionType(file);
s_logger.Debug($"File compression detected as {compressionType.Name} for: {file}");
Logger.Debug($"File compression detected as {compressionType.Name} for: {file}");
}
else
{
Expand Down Expand Up @@ -716,7 +716,7 @@ private int GetFileTransferMaxBytesInMemory()
}
catch (Exception)
{
s_logger.Warn("Default for FILE_TRANSFER_MEMORY_THRESHOLD used due to invalid session value.");
Logger.Warn("Default for FILE_TRANSFER_MEMORY_THRESHOLD used due to invalid session value.");
return FileTransferConfiguration.DefaultMaxBytesInMemory;
}
}
Expand Down Expand Up @@ -782,12 +782,12 @@ private List<string> expandFileNames(string location)
}
}

if (s_logger.IsDebugEnabled())
if (Logger.IsDebugEnabled())
{
s_logger.Debug("Expand " + location + " into: ");
Logger.Debug("Expand " + location + " into: ");
foreach (var filepath in filePaths)
{
s_logger.Debug("\t" + filepath );
Logger.Debug("\t" + filepath );
}
}

Expand Down Expand Up @@ -901,7 +901,7 @@ private void compressFileWithGzip(SFFileMetadata fileMetadata)
}
}

s_logger.Debug($"Compressed {fileToCompress.Name} to {fileMetadata.realSrcFilePath}");
Logger.Debug($"Compressed {fileToCompress.Name} to {fileMetadata.realSrcFilePath}");
FileInfo destInfo = new FileInfo(fileMetadata.realSrcFilePath);
fileMetadata.destFileSize = destInfo.Length;
}
Expand Down Expand Up @@ -1235,7 +1235,7 @@ private SFFileMetadata UploadSingleFile(
}
catch (Exception ex)
{
s_logger.Debug("Unhandled exception while uploading file.", ex);
Logger.Debug("Unhandled exception while uploading file.", ex);
throw;
}
finally
Expand Down Expand Up @@ -1284,7 +1284,7 @@ private async Task<SFFileMetadata> UploadSingleFileAsync(
}
catch (Exception ex)
{
s_logger.Error("UploadSingleFileAsync encountered an error: " + ex.Message);
Logger.Error("UploadSingleFileAsync encountered an error: " + ex.Message);
throw;
}
finally
Expand Down Expand Up @@ -1322,7 +1322,7 @@ private SFFileMetadata DownloadSingleFile(
}
catch (Exception ex)
{
s_logger.Error("DownloadSingleFile encountered an error: " + ex.Message);
Logger.Error("DownloadSingleFile encountered an error: " + ex.Message);
throw;
}
finally
Expand Down Expand Up @@ -1360,7 +1360,7 @@ private async Task<SFFileMetadata> DownloadSingleFileAsync(
}
catch (Exception ex)
{
s_logger.Error("DownloadSingleFileAsync encountered an error: " + ex.Message);
Logger.Error("DownloadSingleFileAsync encountered an error: " + ex.Message);
throw;
}
finally
Expand Down
16 changes: 8 additions & 8 deletions Snowflake.Data/Core/FileTransfer/StorageClient/SFGCSClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SFGCSClient : ISFRemoteStorageClient
/// <summary>
/// The logger.
/// </summary>
private static readonly SFLogger s_logger = SFLoggerFactory.GetLogger<SFGCSClient>();
private static readonly SFLogger Logger = SFLoggerFactory.GetLogger<SFGCSClient>();

/// <summary>
/// The storage client.
Expand All @@ -62,11 +62,11 @@ class SFGCSClient : ISFRemoteStorageClient
/// <param name="stageInfo">The command stage info.</param>
public SFGCSClient(PutGetStageInfo stageInfo)
{
s_logger.Debug("Setting up a new GCS client ");
Logger.Debug("Setting up a new GCS client ");

if (stageInfo.stageCredentials.TryGetValue(GCS_ACCESS_TOKEN, out string accessToken))
{
s_logger.Debug("Constructing client using access token");
Logger.Debug("Constructing client using access token");
AccessToken = accessToken;
GoogleCredential creds = GoogleCredential.FromAccessToken(accessToken, null);
var storageClientBuilder = new StorageClientBuilder
Expand All @@ -78,7 +78,7 @@ public SFGCSClient(PutGetStageInfo stageInfo)
}
else
{
s_logger.Info("No access token received from GS, constructing anonymous client with no encryption support");
Logger.Info("No access token received from GS, constructing anonymous client with no encryption support");
var storageClientBuilder = new StorageClientBuilder
{
UnauthenticatedAccess = true
Expand Down Expand Up @@ -475,7 +475,7 @@ private void HandleDownloadResponse(HttpWebResponse response, SFFileMetadata fil
/// <returns>File Metadata</returns>
private SFFileMetadata HandleFileHeaderErrForPresignedUrls(WebException ex, SFFileMetadata fileMetadata)
{
s_logger.Error("Failed to get file header for presigned url: " + ex.Message);
Logger.Error("Failed to get file header for presigned url: " + ex.Message);

HttpWebResponse response = (HttpWebResponse)ex.Response;
if (response.StatusCode == HttpStatusCode.Unauthorized ||
Expand All @@ -501,7 +501,7 @@ private SFFileMetadata HandleFileHeaderErrForPresignedUrls(WebException ex, SFFi
/// <returns>File Metadata</returns>
private SFFileMetadata HandleFileHeaderErrForGeneratedUrls(WebException ex, SFFileMetadata fileMetadata)
{
s_logger.Error("Failed to get file header for non-presigned url: " + ex.Message);
Logger.Error("Failed to get file header for non-presigned url: " + ex.Message);

HttpWebResponse response = (HttpWebResponse)ex.Response;
if (response.StatusCode == HttpStatusCode.Unauthorized)
Expand Down Expand Up @@ -536,7 +536,7 @@ private SFFileMetadata HandleFileHeaderErrForGeneratedUrls(WebException ex, SFFi
/// <returns>File Metadata</returns>
private SFFileMetadata HandleUploadFileErr(WebException ex, SFFileMetadata fileMetadata)
{
s_logger.Error("Failed to upload file: " + ex.Message);
Logger.Error("Failed to upload file: " + ex.Message);

fileMetadata.lastError = ex;

Expand Down Expand Up @@ -570,7 +570,7 @@ private SFFileMetadata HandleUploadFileErr(WebException ex, SFFileMetadata fileM
/// <returns>File Metadata</returns>
private SFFileMetadata HandleDownloadFileErr(WebException ex, SFFileMetadata fileMetadata)
{
s_logger.Error("Failed to download file: " + ex.Message);
Logger.Error("Failed to download file: " + ex.Message);

fileMetadata.lastError = ex;

Expand Down
Loading

0 comments on commit d2f94f4

Please sign in to comment.