// Noddybox.Net - Provides simple server interaction classes
// Copyright (C) 2003 Ian Cowburn
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// $Id$
//
namespace Noddybox.Net
{
using System;
///
/// Simple debugging class
///
///
/// created by - ianc
/// created on - 06/09/2003 00:31:08
///
public class Debug
{
///
/// Function to recieve debug output if requested
///
public delegate void DebugEvent(string debug);
///
/// Enable/Disable debug console output
///
public static bool Enable
{
get {return m_debug;}
set {m_debug=value;}
}
///
/// Event to capure debug
///
public static event DebugEvent m_event;
///
/// Output debug text
///
public static void Out(System.Object o, string s)
{
string debug="DEBUG: " + o.ToString() + ": " +s;
if (m_debug)
{
Console.WriteLine(debug);
}
if (m_event!=null)
{
m_event(s);
}
}
static private bool m_debug=false;
private Debug()
{
}
}
}