Lobby/Stage Chat Logger - 1.5 Source.

Results 1 to 16 of 16
  1. #1
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Lobby/Stage Chat Logger - 1.5 Source.

    Nothing special, took me 5 min .

    Lobby Logger:
    Code:
    MMatchServer_Channel.cpp, look for:
    
    Code:
    bool MMatchServer::ChannelChat(const MUID& uidPlayer, const MUID& uidChannel, char* pszChat)
    Paste under:
    Code:
    pCmd->AddParameter(new MCommandParameterInt(nGrade));
    This:
    Code:
    	if( uidChannel == pObj->GetChannelUID() )
    	{
    		LOG(LOG_PROG, "[Lobby] | %s : %s ", pObj->GetName(), pszChat);
    	}
    Stage Logger:
    Code:
    MMatchServer_Stage.cpp, look for:
    
    Code:
    bool MMatchServer::StageChat(const MUID& uidPlayer, const MUID& uidStage, char* pszChat)
    Paste under:
    Code:
    pCmd->AddParameter(new MCommandParameterString(pszChat));
    This:
    Code:
    	if( uidStage == pObj->GetStageUID() )
    	{
    		LOG(LOG_PROG, "[Stage] | %s : %s ", pObj->GetName(), pszChat);
    	}
    Note:
    Code:
    LOG_PROG would display in both log file and matchserver screen.
    LOG_FILE would display only in log file of the matchserver.
    Photo from matchserver screen:
    Spoiler:




    Code from matchserver log file:
    Code:
    ../Log
    [07/04/12 00:04:43] [Lobby] | RaGEZONE : This is lobby. 
    [07/04/12 00:04:49] [Stage] | RaGEZONE : This is stage.
    Adding custom file: (Didn't test);

    Quote Originally Posted by Mocro View Post
    To add Log File.

    MCommandCommunicator.h :

    Search for:
    Code:
    enum _LogLevel	{


    add:

    Code:
    LOG_FILELOBBY = 8,


    MCommandCommunicator.cpp

    search for:
    Code:
    void MCommandCommunicator::LOG(unsigned int nLogLevel, const char *pFormat,...)
    
    {


    add:

    Code:
    if (nLogLevel == LOG_FILELOBBY){
      FILE * pFile;
      pFile = fopen ("Logs/lobby.txt","w");
      if (pFile!=NULL)
      {
    		va_list args;
    		static char temp[1024];
    
    
    		va_start(args, pFormat);
    		vsprintf(temp, pFormat, args);
        fputs (temp,pFile);
        fclose (pFile);
      }
    
    
    
    }else


    To use function:

    Code:
    LOG(LOG_FILELOBBY, "[Lobby] | %s : %s ", pObj->GetName(), pszChat);




    Like if you gonna use it
    Last edited by qet123; 04-07-12 at 04:44 PM.


  2. #2
    Proficient Member Mr_Troy is offline
    MemberRank
    Jun 2007 Join Date
    172Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Wouldn't it be better to create separate files from the MatchServer log. This is very unorganized and is hard to read through.

  3. #3
    Account Upgraded | Title Enabled! CobraBite is offline
    MemberRank
    Jan 2011 Join Date
    Where?Location
    281Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Don't you think the matchserver will be exploded if you will have lot's of players : < ? I rather use the Log folder only.

  4. #4
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by Mr_Troy View Post
    Wouldn't it be better to create separate files from the MatchServer log. This is very unorganized and is hard to read through.
    It's very simple one, the new file would make it perfect

    Quote Originally Posted by CobraBite View Post
    Don't you think the matchserver will be exploded if you will have lot's of players : < ? I rather use the Log folder only.
    LOG_FILE would display only in log file of the matchserver.

  5. #5
    Account Upgraded | Title Enabled! CobraBite is offline
    MemberRank
    Jan 2011 Join Date
    Where?Location
    281Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by Mr_Troy View Post
    Wouldn't it be better to create separate files from the MatchServer log. This is very unorganized and is hard to read through.
    Just make another function like the LOG_FILE and rename it to something else.

  6. #6
    Currently Stoned ! Ronny786 is offline
    MemberRank
    Dec 2011 Join Date
    Lost WorldLocation
    984Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    You suggested me some new ideas ^_^ Thanks. <3

  7. #7
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    It may be a mess, but it's actually something useful from u for once.

  8. #8
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by Joe9099 View Post
    It may be a mess, but it's actually something useful from u for once.
    Y U NO LOVE ME
    Quote Originally Posted by Ronny786 View Post
    You suggested me some new ideas ^_^ Thanks. <3
    Well, it's easy and usefull, anyway your welcome

  9. #9
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    To add Log File.

    MCommandCommunicator.h :

    Search for:
    Code:
    enum _LogLevel	{


    add:

    Code:
    LOG_FILELOBBY = 8,


    MCommandCommunicator.cpp

    search for:
    Code:
    void MCommandCommunicator::LOG(unsigned int nLogLevel, const char *pFormat,...)
    
    {


    add:

    Code:
    if (nLogLevel == LOG_FILELOBBY){
      FILE * pFile;
      pFile = fopen ("Logs/lobby.txt","w");
      if (pFile!=NULL)
      {
    		va_list args;
    		static char temp[1024];
    
    
    		va_start(args, pFormat);
    		vsprintf(temp, pFormat, args);
        fputs (temp,pFile);
        fclose (pFile);
      }
    
    
    
    }else


    To use function:

    Code:
    LOG(LOG_FILELOBBY, "[Lobby] | %s : %s ", pObj->GetName(), pszChat);




  10. #10
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by Mocro View Post
    To add Log File.

    MCommandCommunicator.h :

    Search for:
    Code:
    enum _LogLevel	{


    add:

    Code:
    LOG_FILELOBBY = 8,


    MCommandCommunicator.cpp

    search for:
    Code:
    void MCommandCommunicator::LOG(unsigned int nLogLevel, const char *pFormat,...)
    
    {


    add:

    Code:
    if (nLogLevel == LOG_FILELOBBY){
      FILE * pFile;
      pFile = fopen ("Logs/lobby.txt","w");
      if (pFile!=NULL)
      {
    		va_list args;
    		static char temp[1024];
    
    
    		va_start(args, pFormat);
    		vsprintf(temp, pFormat, args);
        fputs (temp,pFile);
        fclose (pFile);
      }
    
    
    
    }else


    To use function:

    Code:
    LOG(LOG_FILELOBBY, "[Lobby] | %s : %s ", pObj->GetName(), pszChat);



    Thanks for developing it, added to the main post.

  11. #11
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Code:
    #include <fstream>
    Code:
    	ofstream chatLog;
    	chatLog.open("ChatLogs.txt", ios::app);
    	sprintf(szLog, "%s From: %s To: %s: %s\n", Time(), pObj->GetName(), pszTargetName, pszMessage);
    	chatLog << szLog;
    Code:
    char* Time( )
    {
    	time_t lTime;
    	struct tm* TM;
    
    	lTime = time( NULL );
    	TM = localtime( &lTime );
    
    	char szBuffer[25];
    	sprintf( szBuffer, "[%d:%d:%d]", TM->tm_mday, TM->tm_hour, TM->tm_min );
    
    	return szBuffer;
    }

  12. #12
    C:\ WizCoder is offline
    MemberRank
    Aug 2010 Join Date
    JapanLocation
    703Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Sigh I wish people ^ would just specify what they had changed instead of just making changes and leaving it up to the viewer to go to the top and look and the default then compare it to the latest just to see what's new.

  13. #13
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by WizCoder View Post
    Sigh I wish people ^ would just specify what they had changed instead of just making changes and leaving it up to the viewer to go to the top and look and the default then compare it to the latest just to see what's new.
    Those aren't edits done to qet's source if that's what you're referring to.

    Anyway, I never said I was spoonfeeding, so yeah, have fun.

  14. #14
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    "%s%s"

    You just made the chatroom crash even easier.

  15. #15
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by ThePhailure772 View Post
    "%s%s"

    You just made the chatroom crash even easier.
    What Jacob is trying to say here is to use try and except handlers or make sure the chat doesn't contain % since that might result into buffer overflow (and crash your server).

    try-except Statement (C++)

    Putting the vsprintf in the try block would do the trick, clean your args in the except block and then return.

  16. #16
    Doggie And Rice. Military is offline
    MemberRank
    Jun 2009 Join Date
    Here and AboutLocation
    3,302Posts

    Re: Lobby/Stage Chat Logger - 1.5 Source.

    Quote Originally Posted by WizCoder View Post
    Sigh I wish people ^ would just specify what they had changed instead of just making changes and leaving it up to the viewer to go to the top and look and the default then compare it to the latest just to see what's new.
    It's call making them learn ..



Advertisement