@@ -470,15 +470,15 @@ end subroutine mpas_log_open
470
470
!> regardless of if all tasks have open log files.
471
471
!> flushNow: flag indicating the message should be flushed immediately.
472
472
!> Note: error and critical error messages are always flushed immediately.
473
- !> intArgs, realArgs, logicArgs: arrays of variable values to be inserted into the
474
- !> message to replace the following characters: $i, $r, $l
473
+ !> intArgs, int8Args, realArgs, logicArgs: arrays of variable values to be inserted into the
474
+ !> message to replace the following characters: $i, $w, $ r, $l
475
475
!> See routine log_expand_string below for details.
476
476
!>
477
477
!
478
478
!-----------------------------------------------------------------------
479
479
480
480
recursive subroutine mpas_log_write (message , messageType , masterOnly , flushNow , &
481
- intArgs , realArgs , logicArgs , err )
481
+ intArgs , int8Args , realArgs , logicArgs , err )
482
482
483
483
use mpas_threading
484
484
@@ -492,6 +492,7 @@ recursive subroutine mpas_log_write(message, messageType, masterOnly, flushNow,
492
492
logical , intent (in ), optional :: masterOnly !< Input: flag to only print message on master task
493
493
logical , intent (in ), optional :: flushNow !< Input: flag to force a flush of the message buffer
494
494
integer , dimension (:), intent (in ), optional :: intArgs !< Input: integer variable values to insert into message
495
+ integer (kind= I8KIND), dimension (:), intent (in ), optional :: int8Args !< Input: integer variable values to insert into message
495
496
real (kind= RKIND), dimension (:), intent (in ), optional :: realArgs !< Input: real variable values to insert into message
496
497
!< Input: exponential notation variable values to insert into message
497
498
logical , dimension (:), intent (in ), optional :: logicArgs !< Input: logical variable values to insert into message
@@ -540,7 +541,7 @@ recursive subroutine mpas_log_write(message, messageType, masterOnly, flushNow,
540
541
541
542
542
543
! Construct message by expanding variable values as needed and inserting message type prefix
543
- call log_expand_string(message, messageExpanded, intArgs= intArgs, logicArgs= logicArgs, realArgs= realArgs)
544
+ call log_expand_string(message, messageExpanded, intArgs= intArgs, int8Args = int8Args, logicArgs= logicArgs, realArgs= realArgs)
544
545
545
546
! Determine message prefix
546
547
select case (messageTypeHere)
@@ -870,6 +871,7 @@ end subroutine log_abort
870
871
!> The variables to be expanded are represented with a ' $' symbol followed
871
872
!> by one of these indicators:
872
873
!> $i - > integer , formatted to be length of integer
874
+ !> $w - > integer (kind= I8KIND), formatted to be length of integer
873
875
!> $l - > logical , fomatted as ' T' or ' F'
874
876
!> $r - > real , formatted as 9 digits of precision for SP mode, 17 for DP mode
875
877
!> Floats are formatted using ' G' format which is smart about
@@ -886,7 +888,7 @@ end subroutine log_abort
886
888
!> can be handled by the string concatenation command (// ).
887
889
!> This routine is based off of mpas_expand_string.
888
890
!-----------------------------------------------------------------------
889
- subroutine log_expand_string (inString , outString , intArgs , logicArgs , realArgs )
891
+ subroutine log_expand_string (inString , outString , intArgs , int8Args , logicArgs , realArgs )
890
892
891
893
implicit none
892
894
@@ -896,6 +898,7 @@ subroutine log_expand_string(inString, outString, intArgs, logicArgs, realArgs)
896
898
character (len=* ), intent (in ) :: inString !< Input: message to be expanded
897
899
898
900
integer , dimension (:), intent (in ), optional :: intArgs
901
+ integer (kind= I8KIND), dimension (:), intent (in ), optional :: int8Args
899
902
!< Input, Optional: array of integer variable values to be used in expansion
900
903
logical , dimension (:), intent (in ), optional :: logicArgs
901
904
!< Input, Optional: array of logical variable values to be used in expansion
@@ -915,8 +918,8 @@ subroutine log_expand_string(inString, outString, intArgs, logicArgs, realArgs)
915
918
! local variables
916
919
!-----------------------------------------------------------------
917
920
integer :: i, curLen
918
- integer :: nInts, nLogicals, nReals, nExps !< the length of the variable arrays passed in
919
- integer :: iInt, iLogical, iReal !< Counter for the current index into each variable array
921
+ integer :: nInts, nInt8s, nLogicals, nReals, nExps !< the length of the variable arrays passed in
922
+ integer :: iInt, iInt8, iLogical, iReal !< Counter for the current index into each variable array
920
923
character (len= ShortStrKIND) :: realFormat !< Format string to create to use for writing real variables to log file
921
924
integer :: realPrecision !< precision of a real variable
922
925
@@ -926,6 +929,7 @@ subroutine log_expand_string(inString, outString, intArgs, logicArgs, realArgs)
926
929
927
930
! Initialize the current index for each variable array to 1
928
931
iInt = 1
932
+ iInt8 = 1
929
933
iLogical = 1
930
934
iReal = 1
931
935
@@ -936,6 +940,12 @@ subroutine log_expand_string(inString, outString, intArgs, logicArgs, realArgs)
936
940
nInts = 0
937
941
endif
938
942
943
+ if (present (int8Args)) then
944
+ nInt8s = size (int8Args)
945
+ else
946
+ nInt8s = 0
947
+ endif
948
+
939
949
if (present (logicArgs)) then
940
950
nLogicals = size (logicArgs)
941
951
else
@@ -973,6 +983,15 @@ subroutine log_expand_string(inString, outString, intArgs, logicArgs, realArgs)
973
983
else
974
984
varPart = errVarPart
975
985
endif
986
+ case (' w' )
987
+ ! make the format large enough to include a large integer (up to 17 digits for 8 - byte int)
988
+ ! it will be trimmed below
989
+ if (iInt8 <= nInt8s) then
990
+ write (varPart,' (i17)' ) int8Args(iInt8)
991
+ iInt8 = iInt8 + 1
992
+ else
993
+ varPart = errVarPart
994
+ endif
976
995
case (' l' )
977
996
if (iLogical <= nLogicals) then
978
997
if (logicArgs(iLogical)) then
0 commit comments