VMware vCloud Suite SDK Perl
The VMware vCloud Suite SDK for Perl supports the client-side vCloud Suite API for access to vCloud services and capabilities
 All Classes Files Functions
Public Attributes | List of all members
Com::Vmware::Vapi::Util::Logger Class Reference

Public Attributes

scalar FAILURE
 
scalar SUCCESS
 
hash verbosity
 

Avaliable Methods

private method writeToScreen ()
 
private method writeLog ()
 
private method open_log ()
 
public method set_verbosity ()
 
public method new_instance ()
 
public method InstanceExists ()
 
public method get_log_name ()
 
public method SetChannelLength ()
 
public method get_instance ()
 
public method log_dumper ()
 
public method log_verbose ()
 
public method get_logpath ()
 
public method close_log ()
 
public method CallingPackage ()
 
public method getCurrentTime ()
 
public method set_logpath ()
 
public method get_zip_path ()
 
public method log_framework ()
 
public method prepareLogs ()
 
public method CallingFunction ()
 
public method log_info ()
 
public method log_error ()
 
public method formatString ()
 
public method log_warning ()
 
public method log_debug ()
 

Detailed Description

This class lets you control the logging behavior. It allows you to control logging messages written to the screen through various verbosity level (0-7) You could change the level or turn off logging capability to the screen anytime.

Assumptions:
None.
Dependencies:
None.
# use Com::Vmware::Vapi::Util::Logger qw(log_info log_error);
# log_error(MSG=>"Proceed with caution...");
# set_logpath(XMLFile=>"Test.Logger.First.xml");
# log_info(Channel=> "mylogs", MSG=>"VAPI Perl SDK Rocks...Way to go");

Member Function Documentation

public method Com::Vmware::Vapi::Util::Logger::CallingFunction ( )

Return name of calling function

Return values
SUCCESS or exception on failure.
Side Effects:
None
# CallingPackage
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::CallingPackage ( )

Return name of calling package

Return values
SUCCESS or exception on failure.
Side Effects:
None
# CallingPackage
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::close_log ( )

A private method to close the log file in the launch host

Parameters
None
Return values
None
Side Effects:
None
# close_log();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::formatString ( )

A private method to customize number of characters in a string and return string removing charcters more than the length specified or add white spaces accordingly.

Parameters
String- string name
Return values
Formatted String
Side Effects:
None
# formatString(String => "ChangeString");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::get_instance ( )

This method is called to get the current object instance or create a new one by calling new_instance().

Return values
An object instance
Side Effects:
None
# my $instance = get_instance()
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::get_log_name ( )

A public method which returns the path to log file

Parameters
None
Return values
None
Side Effects:
None
# get_log_name();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::get_logpath ( )

A public method which returns the path to log direcory

Parameters
None
Return values
None
Side Effects:
None
# get_logpath();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::get_zip_path ( )

A public method which returns the path to zip direcory

Parameters
None
Return values
None
Side Effects:
None
# get_zip_path();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::getCurrentTime ( )

A private method to get current time stamp

Parameters
None
Return values
None
Side Effects:
None
# getCurrentTime();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::InstanceExists ( )

A Public method to return the current instance if it exist

Return values
An object instance
Side Effects:
None
# my $instance = InstanceExists()
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_debug ( )

A Public method to print log debug message

Return values
None
Side Effects:
None
# log_debug(MSG=>"This is a debug message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_dumper ( )

A Public method to print Data:Dumper for the given data type

Return values
None
Side Effects:
None
# LogFramework (MSG=>"This is a debug message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_error ( )

A Public method to print log error message

Return values
None
Side Effects:
None
# log_error(MSG=>"This is a error message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_framework ( )

A Public method to print log framework debug messages

Return values
None
Side Effects:
None
# LogFramework (MSG=>"This is a debug message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_info ( )

A Public method to print log info message

Return values
None
Side Effects:
None
# log_info(MSG=>"This is a info message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_verbose ( )

A Public method to print log info message

Return values
None
Side Effects:
None
# log_verbose(MSG=>"This is a info message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::log_warning ( )

A Public method to print log warning message

Return values
None
Side Effects:
None
# log_warning(MSG=>"This is a warning message");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::new_instance ( )

Undocumented Method

Code:
click to view
private method Com::Vmware::Vapi::Util::Logger::open_log ( )

A private method to open a log file in the launch host

Return values
None
Side Effects:
None
# open_log();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::prepareLogs ( )

A private method to prepare test and log path with the time stamp

Parameters
None
Return values
None
Side Effects:
None
# prepareLogs();
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::set_logpath ( )

A public method to get the XMLFile information and creates log directories

Parameters
XMLFile- Full path to the XML file
Return values
None
Side Effects:
None
# set_logpath (XMLFile => "/source/Proj/ctd/unreviewed/TestLogger.xml");
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::set_verbosity ( )

A public method to set verbosity for the logger object

Parameters
LevelVerbosity Level
Return values
None
Side Effects:
None
# set_verbosity(level => 3);
Code:
click to view
public method Com::Vmware::Vapi::Util::Logger::SetChannelLength ( )

A public method to set number of character in a channel string.

Parameters
Length- Length of the channel
Return values
None
Side Effects:
None
# SetChannelLength(Length => 10);
Code:
click to view
private method Com::Vmware::Vapi::Util::Logger::writeLog ( )

A private method to log messages to log file and the screen

Parameters
MSG- Message
Type- Message Type (Info, Warn...)
Channel- Channel Name
Return values
None
Side Effects:
None
#   writeLog(Channel => $args{Channel},
#            MSG => $args{MSG},
#            Type => "DEBUG");
Code:
click to view
private method Com::Vmware::Vapi::Util::Logger::writeToScreen ( )

A private method to write messages to the screen

Parameters
Channel- Channel Name
Type- Message Type
TimeStamp- TimeStamp details
String- Message String
Return values
None
Side Effects:
None
#      writeToScreen(Channel => $channel, TimeStamp => $timeStamp,
#                    Type => $type, String => $string);
Code:
click to view

The documentation for this class was generated from the following file: