588void TextLogger::AcknowledgeLox( LoxImpl* lox, lang::ContainerOp op )
590 ALIB_IFN_THREADS( (void) lox; )
594 // --------------- insert ------------------
595 if( op == lang::ContainerOp::Insert )
597 if ( Converter == nullptr )
598 Converter= new textlogger::StandardConverter();
600 // register with ALIB lockers (if not done yet)
601 if ( usesStdStreams )
604 int registrationCounter;
606 ALIB_LOCK_WITH( lock )
607 registrationCounter= stdStreamLockRegistrationCounter++;
609 if ( registrationCounter == 0 )
610 SmartLock::StdOutputStreams.AddAcquirer( this );
614 // Variable AUTO_SIZES: use last session's values
622 importMI.
Split( sepPos, importLog, 1 );
626 if( autoSizesLog !=
nullptr && importLog.
IsNotEmpty() )
628 autoSizesLog->
Import( importLog );
637 int maxInSecs=
static_cast<int>( cfgVar.GetInteger() );
639 if ( cfgVar.GetAttribute(
A_CHAR(
"limit"), attrValue ) )
643 if ( maxInSecs > maxMax )
644 maxInSecs=
static_cast<int>( maxMax );
646 MetaInfo->MaxElapsedTime= Ticks::Duration::FromSeconds( maxInSecs );
653 "Default value of variable FORMAT should be kept null" )
655 if(
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetName() ) ) ==
Priorities::
NONE
656 &&
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetTypeName() ) ) ==
Priorities::
NONE )
660 cfgVar.Add( MetaInfo->Format );
661 cfgVar.Add( MetaInfo->VerbosityError );
662 cfgVar.Add( MetaInfo->VerbosityWarning );
663 cfgVar.Add( MetaInfo->VerbosityInfo );
664 cfgVar.Add( MetaInfo->VerbosityVerbose );
665 cfgVar.Add( FmtMsgSuffix );
670 MetaInfo->Format .Reset( cfgVar.GetString( 0) );
671 if( cfgVar.Size() >= 2 ) MetaInfo->VerbosityError .Reset( cfgVar.GetString( 1) );
672 if( cfgVar.Size() >= 3 ) MetaInfo->VerbosityWarning.Reset( cfgVar.GetString( 2) );
673 if( cfgVar.Size() >= 4 ) MetaInfo->VerbosityInfo .Reset( cfgVar.GetString( 3) );
674 if( cfgVar.Size() >= 5 ) MetaInfo->VerbosityVerbose.Reset( cfgVar.GetString( 4) );
675 if( cfgVar.Size() >= 6 ) FmtMsgSuffix .Reset( cfgVar.GetString( 5) );
681 "Default value of variable FORMAT_DATE_TIME should be kept null" )
682 if(
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetName() ) ) ==
Priorities::
NONE
683 &&
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetTypeName() ) ) ==
Priorities::
NONE )
687 cfgVar.Add( MetaInfo->DateFormat );
688 cfgVar.Add( MetaInfo->TimeOfDayFormat );
689 cfgVar.Add( MetaInfo->TimeElapsedDays );
694 MetaInfo->DateFormat .Reset( cfgVar.GetString( 0) );
695 if( cfgVar.Size() >= 2 ) MetaInfo->TimeOfDayFormat .Reset( cfgVar.GetString( 1) );
696 if( cfgVar.Size() >= 3 ) MetaInfo->TimeElapsedDays .Reset( cfgVar.GetString( 2) );
702 "Default value of variable FORMAT_TIME_DIFF should be kept null" )
703 if(
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetName() )) ==
Priorities::
NONE
704 &&
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetTypeName() )) ==
Priorities::
NONE )
708 cfgVar.Add( MetaInfo->TimeDiffMinimum);
709 cfgVar.Add( MetaInfo->TimeDiffNone );
710 cfgVar.Add( MetaInfo->TimeDiffNanos );
711 cfgVar.Add( MetaInfo->TimeDiffMicros );
712 cfgVar.Add( MetaInfo->TimeDiffMillis );
713 cfgVar.Add( MetaInfo->TimeDiffSecs );
714 cfgVar.Add( MetaInfo->TimeDiffMins );
715 cfgVar.Add( MetaInfo->TimeDiffHours );
716 cfgVar.Add( MetaInfo->TimeDiffDays );
721 MetaInfo->TimeDiffMinimum= cfgVar.GetInteger ( 0) ;
722 if( cfgVar.Size() >= 2 ) MetaInfo->TimeDiffNone .Reset( cfgVar.GetString( 1) );
723 if( cfgVar.Size() >= 3 ) MetaInfo->TimeDiffNanos .Reset( cfgVar.GetString( 2) );
724 if( cfgVar.Size() >= 4 ) MetaInfo->TimeDiffMicros .Reset( cfgVar.GetString( 3) );
725 if( cfgVar.Size() >= 5 ) MetaInfo->TimeDiffMillis .Reset( cfgVar.GetString( 4) );
726 if( cfgVar.Size() >= 6 ) MetaInfo->TimeDiffSecs .Reset( cfgVar.GetString( 5) );
727 if( cfgVar.Size() >= 7 ) MetaInfo->TimeDiffMins .Reset( cfgVar.GetString( 6) );
728 if( cfgVar.Size() >= 8 ) MetaInfo->TimeDiffHours .Reset( cfgVar.GetString( 7) );
729 if( cfgVar.Size() >= 9 ) MetaInfo->TimeDiffDays .Reset( cfgVar.GetString( 8) );
735 "Default value of variable FORMAT_MULTILINE should be kept null" )
736 if(
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetName() )) ==
Priorities::
NONE
737 &&
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetTypeName() )) ==
Priorities::
NONE )
741 cfgVar.Add( MultiLineMsgMode );
742 cfgVar.Add( FmtMultiLineMsgHeadline );
743 cfgVar.Add( FmtMultiLinePrefix );
744 cfgVar.Add( FmtMultiLineSuffix );
749 MultiLineMsgMode=
static_cast<int>( cfgVar.GetInteger( 0) ) ;
750 if( cfgVar.Size() >= 2 ) FmtMultiLineMsgHeadline.Reset( cfgVar.GetString( 1) );
751 if( cfgVar.Size() >= 3 ) FmtMultiLinePrefix .Reset( cfgVar.GetString( 2) );
752 if( cfgVar.Size() >= 4 ) FmtMultiLineSuffix .Reset( cfgVar.GetString( 3) );
754 MultiLineDelimiter.SetNull();
756 MultiLineDelimiter.Reset( cfgVar.GetString( 4) );
758 if( cfgVar.Size() >= 6 ) MultiLineDelimiterRepl .Reset( cfgVar.GetString( 5) );
764 "Default value of variable REPLACEMENTS should be kept null" )
765 if(
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetName() )) ==
Priorities::
NONE
766 ||
ALOX.GetConfig().Load( cfgVar.Declare( variableDecl, GetTypeName() )) ==
Priorities::
NONE )
768 for(
int i= 0; i + 1 < cfgVar.Size() ; i+= 2 )
770 String searchString= cfgVar.GetString( i );
771 String replaceString= cfgVar.GetString( i + 1);
772 SetReplacement( searchString, replaceString );
785 if ( usesStdStreams )
788 int registrationCounter;
791 registrationCounter= --this->stdStreamLockRegistrationCounter;
794 if ( registrationCounter == 0 )
801 String256 exportString; exportString.DbgDisableBufferReplacementWarning();
803 strings::util::AutoSizes* autoSizesLog= Converter->GetAutoSizes();
804 if( autoSizesLog !=
nullptr )
806 exportString._(
';' );
807 autoSizesLog->Export( exportString );
809 cfgVar.Add( exportString );
814 String128 destVal( MetaInfo->MaxElapsedTime.InAbsoluteSeconds() );
817 cfgVar.ReplaceValue(0, destVal);
871 Converter->ConvertObjects( msgBuf, logables );
874 for (
size_t i= 0; i < replacements.size() ; i+= 2 )
875 msgBuf.SearchAndReplace( replacements[i],
888 logBuf._<
false>( FmtMsgSuffix );
890 logText( domain, verbosity, logBuf, scope, -1 );
896 if ( MultiLineMsgMode == 0 )
900 if ( MultiLineDelimiter.IsNotNull() )
901 cntReplacements+= msgBuf.SearchAndReplace( MultiLineDelimiter, MultiLineDelimiterRepl, msgBufResetter.
OriginalLength() );
904 String& replacement= MultiLineDelimiterRepl;
905 cntReplacements+= msgBuf.SearchAndReplace(
A_CHAR(
"\r\n"), replacement, msgBufResetter.
OriginalLength() );
906 cntReplacements+= msgBuf.SearchAndReplace(
A_CHAR(
"\r"), replacement, msgBufResetter.
OriginalLength() );
907 cntReplacements+= msgBuf.SearchAndReplace(
A_CHAR(
"\n"), replacement, msgBufResetter.
OriginalLength() );
911 if ( cntReplacements == 0 )
917 logBuf._<
false>( FmtMultiLinePrefix );
919 logBuf._<
false>( FmtMultiLineSuffix );
921 logBuf._<
false>( FmtMsgSuffix );
925 logText( domain, verbosity, logBuf, scope, -1 );
933 integer lbLenBeforeMsgPart= logBuf.Length();
936 while ( actStart < msgBuf.Length() )
943 if ( MultiLineDelimiter.IsEmpty() )
947 actEnd= msgBuf.IndexOf<
false>(
'\n', actStart );
948 if( actEnd > actStart )
950 if( msgBuf.CharAt<
false>(actEnd - 1) ==
'\r' )
959 delimLen= MultiLineDelimiter.Length();
960 actEnd= msgBuf.IndexOf<
false>( MultiLineDelimiter, actStart );
970 logBuf._<
false>( FmtMsgSuffix );
973 logText( domain, verbosity, logBuf, scope, -1 );
981 actEnd= msgBuf.Length();
994 if ( lineNo == 0 && ( MultiLineMsgMode == 3 || MultiLineMsgMode == 4 ) )
997 if ( MultiLineMsgMode == 3 )
999 logBuf._<
false>( FmtMultiLineMsgHeadline );
1001 logText( domain, verbosity, logBuf, scope, 0 );
1005 lbLenBeforeMsgPart= 0;
1009 if ( MultiLineMsgMode == 2 )
1020 logBuf.ShortenTo( lbLenBeforeMsgPart );
1025 logBuf._<
false>( FmtMultiLinePrefix );
1026 logBuf._<
false>( msgBuf, actStart, actEnd - actStart );
1027 logBuf._<
false>( FmtMultiLineSuffix );
1028 actStart= actEnd + delimLen;
1029 if ( actStart >= msgBuf.Length() )
1030 logBuf._<
false>( FmtMsgSuffix );
1031 logText( domain, verbosity, logBuf, scope, lineNo );
virtual ALIB_API void Log(Domain &domain, Verbosity verbosity, Boxes &logables, ScopeInfo &scope) override