Esempio n. 1
0
    public  void SetStartTime( DateTime? startTime= null, String loggerName= null,
    [CallerLineNumber] int cln= 0,[CallerFilePath] String csf="",[CallerMemberName] String cmn="" )
    {
        #if ALOX_DBG_LOG || ALOX_REL_LOG
        try { Acquire();

            // initialize scope information
            scopeInfo.Set( cln,csf,cmn, owner );

            // check if start time was set
            Ticks time= new Ticks( 0L );
            if ( startTime != null)
                time.SetFromDotNetDateTime( startTime.Value );
            else
                time.Set();

            // request logger only from main domain tree
            Logger logger= domains.GetLogger( loggerName );
            if ( logger == null )
            {
                logInternal( Verbosity.Error, "LGR", intMsg.Clear()
                    ._( '\"' ) ._NC( loggerName )._NC( "\": not found. Start time not set." ) );
                return;
            }

            // do
            logger.TimeOfCreation.Set( time );
            logger.TimeOfLastLog .Set( time );

            // log info on this
            logInternal( Verbosity.Info, "LGR", intMsg.Clear()
                ._('\"')._NC(logger)._NC("\": Start time set to ")
                ._NC(startTime.HasValue? startTime.Value.ToString() : "<now>")._('.') );

        } finally { Release(); }
        #endif
    }