Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.StatLogFile


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
//=============================================================================
// Logs game events for stat collection
//
// Logs to a file.
//=============================================================================
class StatLogFile extends StatLog
    native;

var bool bWatermark;

// Internal
var int LogAr; // C++ FArchive*.

// Configs
var string StatLogFile;
var string StatLogFinal;

// File Manipulation
native final function OpenLog();
native final function CloseLog();
native final function Watermark( string EventString );
native final function string GetChecksum();
native final function string GetPlayerChecksum( string PlayerName, string Secret );
native final function FileFlush();
native final function FileLog( string EventString );

// Logging.
function StartLog()
{
    local string FileName;
    local string AbsoluteTime;

    AbsoluteTime = GetShortAbsoluteTime();
    if (!bWorld)
    {
        FileName = LocalLogDir$"\\"$GameName$"."$LocalStandard$"."$AbsoluteTime$"."$Level.Game.GetServerPort();
        StatLogFile = FileName$".tmp";
        StatLogFinal = FileName$".log";
    } else {
        FileName = WorldLogDir$"\\"$GameName$"."$WorldStandard$"."$AbsoluteTime$"."$Level.Game.GetServerPort();
        StatLogFile = FileName$".tmp";
        StatLogFinal = FileName$".log";
        bWatermark = True;
    }

    OpenLog();
}

function StopLog()
{
    FlushLog();
    CloseLog();
}

function FlushLog()
{
    FileFlush();
}

function LogEventString( string EventString )
{
    if( bWatermark )
        Watermark( EventString );
    FileLog( EventString );
    FlushLog();
}

// Return a logfile name if relevant.
function string GetLogFileName()
{
    return StatLogFinal;
}

function LogPlayerConnect(Pawn Player)
{
    local string Checksum;

    if( bWorld )
    {
        if( Player.PlayerReplicationInfo.bIsABot )
            Checksum = "IsABot";
        else
            Checksum = GetPlayerChecksum( Player.PlayerReplicationInfo.PlayerName, PlayerPawn(Player).ngWorldSecret );
        LogEventString( GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Connect"$Chr(9)$Player.PlayerReplicationInfo.PlayerName$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Checksum );
        LogPlayerInfo( Player );
    }
    else Super.LogPlayerConnect( Player );
}

function LogGameEnd( string Reason )
{
    if( bWorld )
    {
        bWatermark = False;
        LogEventString(GetTimeStamp()$Chr(9)$"game_end"$Chr(9)$Reason$Chr(9)$GetChecksum()$"");
    }
    else Super.LogGameEnd(Reason);
}

defaultproperties
{
     StatLogFile="..\Logs\unreal.ngStats.Unknown.log"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: za 22-4-2006 13:00:12.000 - Creation time: za 22-4-2006 13:01:34.078 - Created with UnCodeX