Skip to content

Commit 1101b8e

Browse files
committed
incorporated PR review comments
1 parent 9224c11 commit 1101b8e

File tree

7 files changed

+56
-26
lines changed

7 files changed

+56
-26
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ public static AzureRmRecoveryServicesPolicyBase GetPolicyModel(ProtectionPolicyR
7171
if(((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).RetentionPolicy.GetType() !=
7272
typeof(LongTermRetentionPolicy))
7373
{
74-
Logger.Logger.WriteDebug(Resources.UpdateToNewAzurePowershellWarning);
75-
Logger.Logger.WriteWarning(Resources.UpdateToNewAzurePowershellWarning);
74+
Logger.Instance.WriteDebug(Resources.UpdateToNewAzurePowershellWarning);
75+
Logger.Instance.WriteWarning(Resources.UpdateToNewAzurePowershellWarning);
7676
return null;
7777
}
7878

7979
if (((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).SchedulePolicy.GetType() !=
8080
typeof(SimpleSchedulePolicy))
8181
{
82-
Logger.Logger.WriteDebug(Resources.UpdateToNewAzurePowershellWarning);
83-
Logger.Logger.WriteWarning(Resources.UpdateToNewAzurePowershellWarning);
82+
Logger.Instance.WriteDebug(Resources.UpdateToNewAzurePowershellWarning);
83+
Logger.Instance.WriteWarning(Resources.UpdateToNewAzurePowershellWarning);
8484
return null;
8585
}
8686

@@ -98,8 +98,8 @@ public static AzureRmRecoveryServicesPolicyBase GetPolicyModel(ProtectionPolicyR
9898
// trace warning message, ignore and return
9999
// we will enter this case when service supports new workload and customer
100100
// still using old version of azure powershell
101-
Logger.Logger.WriteDebug(Resources.UpdateToNewAzurePowershellWarning);
102-
Logger.Logger.WriteWarning(Resources.UpdateToNewAzurePowershellWarning);
101+
Logger.Instance.WriteDebug(Resources.UpdateToNewAzurePowershellWarning);
102+
Logger.Instance.WriteWarning(Resources.UpdateToNewAzurePowershellWarning);
103103
return null;
104104
}
105105

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Logger/Commands.RecoveryServices.Backup.Logger.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{5E675749-6139-464A-904C-59C0FFDFEC82}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Microsoft.Azure.Commands.RecoveryServices.Backup.Logger</RootNamespace>
10+
<RootNamespace>Microsoft.Azure.Commands.RecoveryServices.Backup</RootNamespace>
1111
<AssemblyName>Microsoft.Azure.Commands.RecoveryServices.Backup.Logger</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,57 @@
1-
using System;
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
216
using System.Linq;
317
using System.Text;
418
using System.Threading.Tasks;
519
using System.Collections.Generic;
620

7-
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Logger
21+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup
822
{
923
public class Logger
1024
{
11-
private static Action<string> WriteWarningAction { get; set; }
25+
private Action<string> writeWarningAction;
26+
27+
private Action<string> writeDebugAction;
1228

13-
private static Action<string> WriteDebugAction { get; set; }
29+
private Action<string> writeVerboseAction;
1430

15-
private static Action<string> WriteVerboseAction { get; set; }
31+
public static Logger Instance { get; set; }
1632

1733
public Logger(Action<string> writeWarning,
1834
Action<string> writeDebug,
1935
Action<string> writeVerbose)
2036
{
21-
WriteWarningAction = writeWarning;
22-
WriteDebugAction = writeDebug;
23-
WriteVerboseAction = writeVerbose;
37+
writeWarningAction = writeWarning;
38+
writeDebugAction = writeDebug;
39+
writeVerboseAction = writeVerbose;
2440
}
2541

26-
public static void WriteVerbose(string text)
42+
public void WriteVerbose(string text)
2743
{
28-
WriteVerboseAction(text);
44+
writeVerboseAction(text);
2945
}
3046

31-
public static void WriteDebug(string text)
47+
public void WriteDebug(string text)
3248
{
33-
WriteDebugAction(text);
49+
writeDebugAction(text);
3450
}
3551

36-
public static void WriteWarning(string text)
52+
public void WriteWarning(string text)
3753
{
38-
WriteWarningAction(text);
54+
writeWarningAction(text);
3955
}
4056
}
4157
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Logger/Properties/AssemblyInfo.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using System.Reflection;
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Reflection;
216
using System.Runtime.CompilerServices;
317
using System.Runtime.InteropServices;
418

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Commands.RecoveryServices.Backup.Models.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{30B92759-50B3-494E-B9F0-EC9A2CE9D57B}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Microsoft.Azure.Commands.RecoveryServices.Backup.Models</RootNamespace>
10+
<RootNamespace>Microsoft.Azure.Commands.RecoveryServices.Backup</RootNamespace>
1111
<AssemblyName>Microsoft.Azure.Commands.RecoveryServices.Backup.Models</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/RecoveryServices.Backup/RecoveryServicesBackupCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected void InitializeAzureBackupCmdlet()
4040
{
4141
var cloudServicesClient = AzureSession.ClientFactory.CreateClient<CloudServiceManagementClient>(DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
4242
HydraAdapter = new HydraAdapterNS.HydraAdapter(cloudServicesClient.Credentials, cloudServicesClient.BaseUri);
43-
new Logger.Logger(WriteWarning, WriteDebug, WriteVerbose);
43+
Logger.Instance = new Logger(WriteWarning, WriteDebug, WriteVerbose);
4444
}
4545

4646
protected void ExecutionBlock(Action action)

0 commit comments

Comments
 (0)