@@ -9,19 +9,25 @@ namespace PSLogging.Commands
99 [ Cmdlet ( VerbsCommon . Add , "LogFile" ) ]
1010 public class AddLogFileCommand : PSCmdlet
1111 {
12- private StreamType _streams = StreamType . All ;
1312 private ScriptBlock _errorCallback ;
14- private string _path ;
1513 private LogFile _inputObject ;
14+ private string _path ;
15+ private StreamType _streams = StreamType . All ;
1616
1717 #region Parameters
18+
1819 [ Parameter ( Mandatory = true ,
1920 Position = 0 ,
2021 ParameterSetName = "New" ) ]
2122 public string Path
2223 {
2324 get { return _path ; }
24- set { _path = System . IO . Path . IsPathRooted ( value ) ? value : System . IO . Path . Combine ( SessionState . Path . CurrentLocation . Path , value ) ; }
25+ set
26+ {
27+ _path = System . IO . Path . IsPathRooted ( value )
28+ ? value
29+ : System . IO . Path . Combine ( SessionState . Path . CurrentLocation . Path , value ) ;
30+ }
2531 }
2632
2733 [ Parameter ( ParameterSetName = "New" ) ]
@@ -83,7 +89,9 @@ public string Path
8389 get { return _path ; }
8490 set
8591 {
86- _path = System . IO . Path . IsPathRooted ( value ) ? value : System . IO . Path . Combine ( SessionState . Path . CurrentLocation . Path , value ) ;
92+ _path = System . IO . Path . IsPathRooted ( value )
93+ ? value
94+ : System . IO . Path . Combine ( SessionState . Path . CurrentLocation . Path , value ) ;
8795 }
8896 }
8997
@@ -93,7 +101,8 @@ protected override void EndProcessing()
93101 {
94102 var logFile = subscriber as LogFile ;
95103
96- if ( logFile != null && ( _path == null || System . IO . Path . GetFullPath ( logFile . Path ) == System . IO . Path . GetFullPath ( _path ) ) )
104+ if ( logFile != null &&
105+ ( _path == null || System . IO . Path . GetFullPath ( logFile . Path ) == System . IO . Path . GetFullPath ( _path ) ) )
97106 {
98107 WriteObject ( logFile ) ;
99108 }
@@ -136,15 +145,15 @@ protected override void EndProcessing()
136145 [ Cmdlet ( VerbsCommon . Add , "OutputSubscriber" ) ]
137146 public class AddOutputSubscriberCommand : PSCmdlet
138147 {
139- private ScriptBlock _onWriteOutput ;
148+ private ScriptBlockOutputSubscriber _inputObject ;
140149 private ScriptBlock _onWriteDebug ;
141- private ScriptBlock _onWriteVerbose ;
142150 private ScriptBlock _onWriteError ;
151+ private ScriptBlock _onWriteOutput ;
152+ private ScriptBlock _onWriteVerbose ;
143153 private ScriptBlock _onWriteWarning ;
144154
145- private ScriptBlockOutputSubscriber _inputObject ;
146-
147155 #region Parameters
156+
148157 [ Parameter ( ParameterSetName = "New" ) ]
149158 public ScriptBlock OnWriteOutput
150159 {
@@ -189,6 +198,7 @@ public ScriptBlockOutputSubscriber InputObject
189198 get { return _inputObject ; }
190199 set { _inputObject = value ; }
191200 }
201+
192202 #endregion
193203
194204 protected override void EndProcessing ( )
@@ -197,7 +207,11 @@ protected override void EndProcessing()
197207
198208 if ( ParameterSetName == "New" )
199209 {
200- subscriber = new ScriptBlockOutputSubscriber ( _onWriteOutput , _onWriteDebug , _onWriteVerbose , _onWriteError , _onWriteWarning ) ;
210+ subscriber = new ScriptBlockOutputSubscriber ( _onWriteOutput ,
211+ _onWriteDebug ,
212+ _onWriteVerbose ,
213+ _onWriteError ,
214+ _onWriteWarning ) ;
201215 WriteObject ( subscriber ) ;
202216 }
203217 else
@@ -217,7 +231,10 @@ protected override void EndProcessing()
217231 foreach ( IHostIoSubscriber subscriber in HostIoInterceptor . GetInterceptor ( ) . Subscribers )
218232 {
219233 var scriptBlockSubscriber = subscriber as ScriptBlockOutputSubscriber ;
220- if ( scriptBlockSubscriber != null ) WriteObject ( scriptBlockSubscriber ) ;
234+ if ( scriptBlockSubscriber != null )
235+ {
236+ WriteObject ( scriptBlockSubscriber ) ;
237+ }
221238 }
222239 }
223240 } // End GetOutputSubscriberCommand class
@@ -239,4 +256,4 @@ protected override void EndProcessing()
239256
240257// ReSharper restore MemberCanBePrivate.Global
241258// ReSharper restore UnusedAutoPropertyAccessor.Global
242- // ReSharper restore UnusedMember.Global
259+ // ReSharper restore UnusedMember.Global
0 commit comments