2727 * http://opcfoundation.org/License/MIT/1.00/
2828 * ======================================================================*/
2929
30+ using Microsoft . Extensions . Logging ;
3031using Opc . Ua ;
3132using Opc . Ua . Server ;
3233using System ;
@@ -363,13 +364,14 @@ public static uint CreateError(
363364 uint code ,
364365 OperationContext context ,
365366 DiagnosticInfoCollection diagnosticInfos ,
366- int index )
367+ int index ,
368+ ILogger logger )
367369 {
368370 ServiceResult error = new ServiceResult ( code ) ;
369371
370372 if ( ( context . DiagnosticsMask & DiagnosticsMasks . OperationAll ) != 0 )
371373 {
372- diagnosticInfos [ index ] = new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable ) ;
374+ diagnosticInfos [ index ] = new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable , logger ) ;
373375 }
374376
375377 return error . Code ;
@@ -382,14 +384,15 @@ public static bool CreateError(
382384 uint code ,
383385 StatusCodeCollection results ,
384386 DiagnosticInfoCollection diagnosticInfos ,
385- OperationContext context )
387+ OperationContext context ,
388+ ILogger logger )
386389 {
387390 ServiceResult error = new ServiceResult ( code ) ;
388391 results . Add ( error . Code ) ;
389392
390393 if ( ( context . DiagnosticsMask & DiagnosticsMasks . OperationAll ) != 0 )
391394 {
392- diagnosticInfos . Add ( new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable ) ) ;
395+ diagnosticInfos . Add ( new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable , logger ) ) ;
393396 return true ;
394397 }
395398
@@ -404,14 +407,15 @@ public static bool CreateError(
404407 StatusCodeCollection results ,
405408 DiagnosticInfoCollection diagnosticInfos ,
406409 int index ,
407- OperationContext context )
410+ OperationContext context ,
411+ ILogger logger )
408412 {
409413 ServiceResult error = new ServiceResult ( code ) ;
410414 results [ index ] = error . Code ;
411415
412416 if ( ( context . DiagnosticsMask & DiagnosticsMasks . OperationAll ) != 0 )
413417 {
414- diagnosticInfos [ index ] = new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable ) ;
418+ diagnosticInfos [ index ] = new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable , logger ) ;
415419 return true ;
416420 }
417421
@@ -439,7 +443,8 @@ public static void CreateSuccess(
439443 /// </summary>
440444 public static DiagnosticInfoCollection CreateDiagnosticInfoCollection (
441445 OperationContext context ,
442- IList < ServiceResult > errors )
446+ IList < ServiceResult > errors ,
447+ ILogger logger )
443448 {
444449 // all done if no diagnostics requested.
445450 if ( ( context . DiagnosticsMask & DiagnosticsMasks . OperationAll ) == 0 )
@@ -454,7 +459,7 @@ public static DiagnosticInfoCollection CreateDiagnosticInfoCollection(
454459 {
455460 if ( ServiceResult . IsBad ( error ) )
456461 {
457- results . Add ( new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable ) ) ;
462+ results . Add ( new DiagnosticInfo ( error , context . DiagnosticsMask , false , context . StringTable , logger ) ) ;
458463 }
459464 else
460465 {
@@ -471,6 +476,7 @@ public static DiagnosticInfoCollection CreateDiagnosticInfoCollection(
471476 public static StatusCodeCollection CreateStatusCodeCollection (
472477 OperationContext context ,
473478 IList < ServiceResult > errors ,
479+ ILogger logger ,
474480 out DiagnosticInfoCollection diagnosticInfos )
475481 {
476482 diagnosticInfos = null ;
@@ -494,7 +500,7 @@ public static StatusCodeCollection CreateStatusCodeCollection(
494500 // only generate diagnostics if errors exist.
495501 if ( noErrors )
496502 {
497- diagnosticInfos = CreateDiagnosticInfoCollection ( context , errors ) ;
503+ diagnosticInfos = CreateDiagnosticInfoCollection ( context , errors , logger ) ;
498504 }
499505
500506 return results ;
@@ -510,7 +516,8 @@ public static StatusCodeCollection CreateStatusCodeCollection(
510516 public static DiagnosticInfo CreateDiagnosticInfo (
511517 IServerInternal server ,
512518 OperationContext context ,
513- ServiceResult error )
519+ ServiceResult error ,
520+ ILogger logger )
514521 {
515522 if ( error == null )
516523 {
@@ -528,7 +535,8 @@ public static DiagnosticInfo CreateDiagnosticInfo(
528535 translatedError ,
529536 context . DiagnosticsMask ,
530537 false ,
531- context . StringTable ) ;
538+ context . StringTable ,
539+ logger ) ;
532540
533541 return diagnosticInfo ;
534542 }
0 commit comments