1<?php
2	/**
3	* Logging helper functions
4	* @author Doug Dicks <doug@revelanttech.com>
5	* @copyright Copyright (C) 2000,2001 Mark Peters
6	* @copyright Portions Copyright (C) 2004 Free Software Foundation, Inc. http://www.fsf.org/
7	* @license http://www.fsf.org/licenses/gpl.html GNU General Public License
8	* @package phpgwapi
9	* @subpackage application
10	* @version $Id: log_functions.inc.php 14407 2004-02-10 13:51:20Z ceb $
11	*
12	* This is just an alternative API to the logging methods in
13	* class.errorlog2.inc.php.  They allow you to call the logging methods
14	* without having to always use a  $GLOBALS['phpgw']->log-> with all of
15	* your logging statements.  For example, instead of
16	* $GLOBALS['phpgw']->log->debug(); you can use log_debug();
17	* The goal is to make it easier to add logging to your code.
18	*/
19
20	/**
21	* Log a message at DEBUG level
22	*/
23	function log_debug()
24	{
25		if ( isset($GLOBALS['phpgw']->log) )
26		{
27			$arg_array = func_get_args();
28			$GLOBALS['phpgw']->log->log_if_level('D', $GLOBALS['phpgw']->log->make_parms($arg_array));
29		}
30	}
31
32	function log_info()
33	{
34		if ( isset($GLOBALS['phpgw']->log) )
35		{
36			$arg_array = func_get_args();
37			$GLOBALS['phpgw']->log->log_if_level('I', $GLOBALS['phpgw']->log->make_parms($arg_array));
38		}
39	}
40
41	function log_warn()
42	{
43		if ( isset($GLOBALS['phpgw']->log) )
44		{
45		$arg_array = func_get_args();
46		$GLOBALS['phpgw']->log->log_if_level('W', $GLOBALS['phpgw']->log->make_parms($arg_array));
47		}
48	}
49
50	function log_error()
51	{
52		if ( isset($GLOBALS['phpgw']->log) )
53		{
54			$arg_array = func_get_args();
55			$GLOBALS['phpgw']->log->log_if_level('E', $GLOBALS['phpgw']->log->make_parms($arg_array));
56		}
57	}
58
59	function log_fatal()
60	{
61		if ( isset($GLOBALS['phpgw']->log) )
62		{
63			$arg_array = func_get_args();
64			$GLOBALS['phpgw']->log->log_if_level('F', $GLOBALS['phpgw']->log->make_parms($arg_array));
65		}
66	}
67
68
69	/* For backward compatibility with some of the existing debugging statements */
70	function print_debug($message,$var = 'messageonly',$part = 'app', $level = 3)
71	{
72		if ( $var == 'messageonly' )
73		{
74			log_debug($message);
75		}
76		else
77		{
78			log_debug($message, $var);
79		}
80	}
81
82?>
83