Ejemplo n.º 1
0
def test_stdio(stream, idx, capfd, parse):
	fd = ud.init(stream, ud.NO_FLUSH, ud.FUNCTION)
	assert hasattr(fd, 'write')
	ud.exit()

	output = capfd.readouterr()
	assert [typ for typ, groups in parse(output[idx])] == ['init', 'exit']
Ejemplo n.º 2
0
def tmplog(tmpdir):
	"""
	Setup temporary logging.
	"""
	tmp = tmpdir.ensure('log')
	fd = ud.init(str(tmp), ud.NO_FLUSH, ud.FUNCTION)
	assert hasattr(fd, 'write')

	yield tmp
# you and Univention and not subject to the GNU AGPL V3.
#
# In the case you use this program under the terms of the GNU AGPL V3,
# the program is provided 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License with the Debian GNU/Linux or Univention distribution in file
# /usr/share/common-licenses/AGPL-3; if not, see
# <http://www.gnu.org/licenses/>.

import univention.debug2 as ud

ud.init('/tmp/univention.debug2.log', 1, 1)
ud.set_level(ud.PROCESS, ud.ERROR)
ud.set_level(ud.LISTENER, ud.WARN)
ud.set_level(ud.NETWORK, ud.PROCESS)
ud.set_level(ud.LDAP, ud.INFO)
ud.set_level(ud.ADMIN, ud.ALL)

for lvl in [ud.ERROR, ud.WARN, ud.PROCESS, ud.INFO, ud.ALL]:
	for mod in [ud.ADMIN, ud.PROCESS, ud.LISTENER, ud.NETWORK, ud.LDAP]:
		ud.debug(mod, lvl, '==> send msg to %s with level %s' % (mod, lvl))


ud.set_level(ud.ADMIN, ud.ERROR)
ud.debug(ud.ADMIN, ud.ERROR, '==> admin error')
ud.debug(ud.ADMIN, ud.WARN, '==> admin warn')
ud.debug(ud.ADMIN, ud.PROCESS, '==> admin process')
Ejemplo n.º 4
0
# you and Univention and not subject to the GNU AGPL V3.
#
# In the case you use this program under the terms of the GNU AGPL V3,
# the program is provided 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License with the Debian GNU/Linux or Univention distribution in file
# /usr/share/common-licenses/AGPL-3; if not, see
# <http://www.gnu.org/licenses/>.

import univention.debug2 as ud

ud.init( '/tmp/univention.debug2.log', 1, 1)
ud.set_level( ud.PROCESS, ud.ERROR )
ud.set_level( ud.LISTENER, ud.WARN )
ud.set_level( ud.NETWORK, ud.PROCESS )
ud.set_level( ud.LDAP, ud.INFO )
ud.set_level( ud.ADMIN, ud.ALL )

for lvl in [ ud.ERROR, ud.WARN, ud.PROCESS, ud.INFO, ud.ALL ]:
	for mod in [ ud.ADMIN, ud.PROCESS, ud.LISTENER, ud.NETWORK, ud.LDAP ]:
		ud.debug( mod, lvl, '==> send msg to %s with level %s' % (mod, lvl) )


ud.set_level( ud.ADMIN, ud.ERROR )
ud.debug( ud.ADMIN, ud.ERROR, '==> admin error' )
ud.debug( ud.ADMIN, ud.WARN, '==> admin warn' )
ud.debug( ud.ADMIN, ud.PROCESS, '==> admin process' )