Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

baseobj(1) [centos man page]

BASEOBJ(1)							   baseobj 1.0.1							BASEOBJ(1)

baseobj - Base object DESCRIPTION
Base class so objects will inherit the methods which provide the string representation of the object and methods to change the verbosity of such string representation. It also includes a simple debug printing and logging mechanism including methods to change the debug verbosity level and methods to add debug levels. CLASSES
class BaseObj(__builtin__.object) Base class so objects will inherit the methods which provide the string representation of the object and a simple debug printing and log- ging mechanism. Methods defined here: --------------------- __init__(self, *kwts, **kwds) Constructor Initialize object's private data according to the arguments given Examples: # Named arguments x = BaseObj(a=1, b=2) # Dictionary argument x = BaseObj({'a':1, 'b':2}) # Tuple arguments: first for keys and second for the values x = BaseObj(['a', 'b'], [1, 2]) # All of the above will create an object having two attributes: x.a = 1 and x.b = 2 __repr__(self) String representation of object The representation depends on the verbose level set by debug_repr(). If set to 0 the generic object representation is returned, else the representation of the object includes all object attributes and their values with proper indentation. __str__ = __repr__(self) close_log(self) Close log file. debug_level(self, level=0) Set debug level mask. level: Level to set. This could be a number or a string expression of names defined by debug_map() Examples: # Set level x.debug_level(0xFF) # Set level using expression x.debug_level('all') x.debug_level('debug ^ 1') dprint(self, level, msg, indent=0) Print debug message if level is allowed by the verbose level given in debug_level(). open_log(self, logfile) Open log file. Static methods defined here: ---------------------------- debug_map(bitmap, name='', disp='') Add a debug mapping. Generic debug levels map <bitmap> <name> <disp prefix> 0x000 'none' 0x001 'info' 'INFO: ' # Display info messages only 0x0FF 'debug' 'DBG: ' # Display info and all debug messages (0x02-0x80) >0x100 user defined verbose levels debug_repr(level=None) Return or set verbose level of object's string representation. When setting the verbose level, return the verbose level before set- ting it. level: Level of verbosity to set dindent(indent) Set global indentation. write_log(data) Write data to log file. BUGS
No known bugs. AUTHOR
Jorge Mora ( NFStest 1.0.2 10 April 2013 BASEOBJ(1)

Check Out this Related Man Page

Net::XMPP::Debug(3pm)					User Contributed Perl Documentation				     Net::XMPP::Debug(3pm)

Net::XMPP::Debug - XMPP Debug Module SYNOPSIS
Net::XMPP::Debug is a module that provides a developer easy access to logging debug information. DESCRIPTION
Debug is a helper module for the Net::XMPP modules. It provides the Net::XMPP modules with an object to control where, how, and what is logged. Basic Functions $Debug = new Net::XMPP::Debug(); $Debug->Init(level=>2, file=>"stdout", header=>"MyScript"); $Debug->Log0("Connection established"); METHODS
Basic Functions new(hash) - creates the Debug object. The hash argument is passed to the Init function. See that function description below for the valid settings. Init(level=>integer, - initializes the debug object. The level file=>string, determines the maximum level of debug header=>string, messages to log: setdefault=>0|1, 0 - Base level Output (default) usedefault=>0|1, 1 - High level API calls time=>0|1) 2 - Low level API calls ... N - Whatever you want.... The file determines where the debug log goes. You can either specify a path to a file, or "stdout" (the default). "stdout" tells Debug to send all of the debug info sent to this object to go to stdout. header is a string that will preappended to the beginning of all log entries. This makes it easier to see what generated the log entry (default is "Debug"). setdefault saves the current filehandle and makes it available for other Debug objects to use. To use the default set usedefault to 1. The time parameter specifies whether or not to add a timestamp to the beginning of each logged line. LogN(array) - Logs the elements of the array at the corresponding debug level N. If you pass in a reference to an array or hash then they are printed in a readable way. (ie... Log0, Log2, Log100, etc...) EXAMPLE
$Debug = new Net::XMPP:Debug(level=>2, header=>"Example"); $Debug->Log0("test"); $Debug->Log2("level 2 test"); $hash{a} = "atest"; $hash{b} = "btest"; $Debug->Log1("hashtest",\%hash); You would get the following log: Example: test Example: level 2 test Example: hashtest { a=>"atest" b=>"btest" } If you had set the level to 1 instead of 2 you would get: Example: test Example: hashtest { a=>"atest" b=>"btest" } AUTHOR
This module is free software, you can redistribute it and/or modify it under the LGPL. perl v5.14.2 2012-11-06 Net::XMPP::Debug(3pm)

Featured Tech Videos