Google-Code-Fork / tibiaapi

Automatically exported from code.google.com/p/tibiaapi
MIT License
0 stars 0 forks source link

Add Proxy Logging setting #204

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

you can add proxy.Logging setting - to easily turn on/off proxy logging.

protected void WriteDebug(string msg)
{
    if (Logging)
    {
        try
        {
            lock (debugLock)
            {
                System.IO.StreamWriter sw = new
System.IO.StreamWriter(System.IO.Path.Combine(Application.StartupPath,
"proxy_log.txt"), true);
                sw.WriteLine(System.DateTime.Now.ToShortDateString() + " " +
System.DateTime.Now.ToLongTimeString() + " " + msg + "\nLast received
packet types: " + GetLastReceivedPacketTypesString());
                sw.Close();
            }
        }
        catch
        {
        }
    }
    else
    {
        return;
    }
}

And somewhere in ProxyBase.cs

public bool Logging = true;

So you can easily turn on\off logs.
client.IO.Proxy.Logging = false;

Muttley

Original issue reported on code.google.com by muttd...@gmail.com on 26 Apr 2010 at 1:11

GoogleCodeExporter commented 9 years ago
Personally, I see this as an unneeded feature. However, I'm going to leave this 
open if another developer happens to think otherwise.

Original comment by joebingham07@gmail.com on 29 Sep 2010 at 4:40

GoogleCodeExporter commented 9 years ago
It would take about 2 minutes to implement and test, I don't see why not. I'll 
take care of it.

Original comment by ian320 on 29 Sep 2010 at 5:00

GoogleCodeExporter commented 9 years ago
For some reason, when I reviewed this last night, I thought it only logged the 
last packet upon debug. I now understand it would log all packets, so I believe 
it would be a good implementation. I don't, however, think it should be limited 
to just the proxy. Which I'm sure you already had that in mind.

Original comment by joebingham07@gmail.com on 29 Sep 2010 at 7:42

GoogleCodeExporter commented 9 years ago
We already log the last N packets (5 or 10 I think) and output them whenever 
there is an error. This request is a bit different; asking us to have an option 
to disable logging entirely.

Original comment by ian320 on 19 Oct 2010 at 8:54