ensembl-hive  2.8.1
Bio::EnsEMBL::Utils::Logger Class Reference

Public Member Functions

public Bio::EnsEMBL::Utils::ConversionSupport new ()
 
public Boolean log_generic ()
 
public void error ()
 
public Boolean warning ()
 
public info ()
 
public Boolean debug ()
 
public log_progress ()
 
public log_progressbar ()
 
public init_progress ()
 
public Filehandle log_filehandle ()
 
public extract_log_identifier ()
 
public Filehandle init_log ()
 
public Boolean finish_log ()
 
public runtime ()
 
public String date_and_mem ()
 
public time_and_mem ()
 
public String date ()
 
public String mem ()
 
public Int warning_count ()
 
public logfile ()
 
public log_auto_id ()
 
public logauto ()
 
public create_auto_logfile ()
 
public logpath ()
 
public logappend ()
 
public is_component ()
 
public loglevel ()
 
public log_error ()
 
public log_warning ()
 
public log ()
 
public log_verbose ()
 
public log_stamped ()
 

Detailed Description

Synopsis

my $serverroot = '/path/to/ensembl';
my $suport = new Bio::EnsEMBL::Utils::ConversionSupport($serverroot);
# parse common options
$support->parse_common_options;
# parse extra options for your script
$support->parse_extra_options( 'string_opt=s', 'numeric_opt=n' );
# ask user if he wants to run script with these parameters
$support->confirm_params;
# see individual method documentation for more stuff

Description

This module is a collection of common methods and provides helper
functions for the Vega release and schema conversion scripts. Amongst
others, it reads options from a config file, parses commandline options
and does logging.

Definition at line 36 of file Logger.pm.

Member Function Documentation

◆ create_auto_logfile()

public Bio::EnsEMBL::Utils::Logger::create_auto_logfile ( )
  Arg[1]      : 
  Example     :
  Description : 
  Return type : 
  Exceptions  : 
  Caller      : 
  Status      : At Risk
              : under development
 
Code:
click to view

◆ date()

public String Bio::EnsEMBL::Utils::Logger::date ( )
  Example     :
print "Date: " . $support->date . "\n";
  Description : Prints a nicely formatted timestamp (YYYY-DD-MM hh:mm:ss)
  Return type : String - the timestamp
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ date_and_mem()

public String Bio::EnsEMBL::Utils::Logger::date_and_mem ( )
  Example     :
print LOG "Time, memory usage: ".$support->date_and_mem."\n";
  Description : Prints a timestamp and the memory usage of your script.
  Return type : String - timestamp and memory usage
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ debug()

public Boolean Bio::EnsEMBL::Utils::Logger::debug ( )
  Arg[1]      : String $txt - the warning text to log
  Arg[2]      : Int $indent - indentation level for log message
  Example     :
my $log = $support->log_filehandle;
$support->log_verbose('Log this verbose message.\n', 1);
  Description : Logs a message via $self->log if --verbose option was used
  Return type : TRUE on success, FALSE if not verbose
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ error()

public void Bio::EnsEMBL::Utils::Logger::error ( )
  Arg[1]      : String $txt - the error text to log
  Arg[2]      : Int $indent - indentation level for log message
  Example     :
my $log = $support->log_filehandle;
$support->log_error('Log foo.\n', 1);
  Description : Logs a message via $self->log and exits the script.
  Return type : none
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ extract_log_identifier()

public Bio::EnsEMBL::Utils::Logger::extract_log_identifier ( )
  Arg[1]      : 
  Example     :
  Description : 
  Return type : 
  Exceptions  : 
  Caller      : 
  Status      :
 
Code:
click to view

◆ finish_log()

public Boolean Bio::EnsEMBL::Utils::Logger::finish_log ( )
  Example     :
$support->finish_log;
  Description : Writes footer information to a logfile. This includes the
                number of logged warnings, timestamp and memory footprint.
  Return type : TRUE on success
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ info()

public Bio::EnsEMBL::Utils::Logger::info ( )

Undocumented method

Code:
click to view

◆ init_log()

public Filehandle Bio::EnsEMBL::Utils::Logger::init_log ( )
  Example     :
$support->init_log;
  Description : Opens a filehandle to the logfile and prints some header
                information to this file. This includes script name, date, user
                running the script and parameters the script will be running
                with.
  Return type : Filehandle - the log filehandle
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ init_progress()

public Bio::EnsEMBL::Utils::Logger::init_progress ( )

Undocumented method

Code:
click to view

◆ is_component()

public Bio::EnsEMBL::Utils::Logger::is_component ( )
  Arg[1]      : 
  Example     :
  Description : 
  Return type : 
  Exceptions  : 
  Caller      : 
  Status      :
 
Code:
click to view

◆ log()

public Bio::EnsEMBL::Utils::Logger::log ( )

Undocumented method

Code:
click to view

◆ log_auto_id()

public Bio::EnsEMBL::Utils::Logger::log_auto_id ( )
  Arg[1]      : 
  Example     :
  Description : 
  Return type : 
  Exceptions  : 
  Caller      : 
  Status      :
 
Code:
click to view

◆ log_error()

public Bio::EnsEMBL::Utils::Logger::log_error ( )

Undocumented method

Code:
click to view

◆ log_filehandle()

public Filehandle Bio::EnsEMBL::Utils::Logger::log_filehandle ( )
  Arg[1]      : (optional) String $mode - file access mode
  Example     :
my $log = $support->log_filehandle;
@section autotoc_md33 print to the filehandle
print $log 'Lets start logging...\n';
@section autotoc_md34 log via the wrapper $self->log()
$support->log('Another log message.\n');
  Description : Returns a filehandle for logging (STDERR by default, logfile if
                set from config or commandline). You can use the filehandle
                directly to print to, or use the smart wrapper $self->log().
                Logging mode (truncate or append) can be set by passing the
                mode as an argument to log_filehandle(), or with the
                --logappend commandline option (default: truncate)
  Return type : Filehandle - the filehandle to log to
  Exceptions  : thrown if logfile can't be opened
  Caller      : general
 
Code:
click to view

◆ log_generic()

public Boolean Bio::EnsEMBL::Utils::Logger::log_generic ( )
  Arg[1]      : String $txt - the text to log
  Arg[2]      : Int $indent - indentation level for log message
  Example     :
my $log = $support->log_filehandle;
$support->log('Log foo.\n', 1);
  Description : Logs a message to the filehandle initialised by calling
                $self->log_filehandle(). You can supply an indentation level
                to get nice hierarchical log messages.
  Return type : true on success
  Exceptions  : thrown when no filehandle can be obtained
  Caller      : general
 
Code:
click to view

◆ log_progress()

public Bio::EnsEMBL::Utils::Logger::log_progress ( )

Undocumented method

Code:
click to view

◆ log_progressbar()

public Bio::EnsEMBL::Utils::Logger::log_progressbar ( )

Undocumented method

Code:
click to view

◆ log_stamped()

public Bio::EnsEMBL::Utils::Logger::log_stamped ( )

Undocumented method

Code:
click to view

◆ log_verbose()

public Bio::EnsEMBL::Utils::Logger::log_verbose ( )

Undocumented method

Code:
click to view

◆ log_warning()

public Bio::EnsEMBL::Utils::Logger::log_warning ( )

Undocumented method

Code:
click to view

◆ logappend()

public Bio::EnsEMBL::Utils::Logger::logappend ( )
  Arg[1]      : 
  Example     :
  Description : 
  Return type : 
  Exceptions  : 
  Caller      : 
  Status      :
 
Code:
click to view

◆ logauto()

public Bio::EnsEMBL::Utils::Logger::logauto ( )

Undocumented method

Code:
click to view

◆ logfile()

public Bio::EnsEMBL::Utils::Logger::logfile ( )
  Arg[1]      : 
  Example     :
  Description : Getter and setter for the logfile
  Return type :
  Exceptions  : 
  Caller      : 
  Status      :
 
Code:
click to view

◆ loglevel()

public Bio::EnsEMBL::Utils::Logger::loglevel ( )

Undocumented method

Code:
click to view

◆ logpath()

public Bio::EnsEMBL::Utils::Logger::logpath ( )
  Arg[1]      : 
  Example     :
  Description : 
  Return type : 
  Exceptions  : 
  Caller      : 
  Status      :
 
Code:
click to view

◆ mem()

public String Bio::EnsEMBL::Utils::Logger::mem ( )
  Example     :
print "Memory usage: " . $support->mem . "\n";
  Description : Prints the memory used by your script. Not sure about platform
                dependence of this call ...
  Return type : String - memory usage
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ new()

public Bio::EnsEMBL::Utils::ConversionSupport Bio::EnsEMBL::Utils::Logger::new ( )
  Arg[1]      : String $serverroot - root directory of your ensembl sandbox
  Example     :
'/path/to/ensembl');
  Description : constructor
  Return type : Bio::EnsEMBL::Utils::ConversionSupport object
  Exceptions  : thrown on invalid loglevel
  Caller      : general
 
Code:
click to view

◆ runtime()

public Bio::EnsEMBL::Utils::Logger::runtime ( )

Undocumented method

Code:
click to view

◆ time_and_mem()

public Bio::EnsEMBL::Utils::Logger::time_and_mem ( )

Undocumented method

Code:
click to view

◆ warning()

public Boolean Bio::EnsEMBL::Utils::Logger::warning ( )
  Arg[1]      : String $txt - the warning text to log
  Arg[2]      : Int $indent - indentation level for log message
  Example     :
my $log = $support->log_filehandle;
$support->log_warning('Log foo.\n', 1);
  Description : Logs a message via $self->log and increases the warning counter.
  Return type : true on success
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ warning_count()

public Int Bio::EnsEMBL::Utils::Logger::warning_count ( )
  Example     :
print LOG "There were ".$support->warnings." warnings.\n";
  Description : Returns the number of warnings encountered while running the
                script (the warning counter is increased by $self->log_warning).
  Return type : Int - number of warnings
  Exceptions  : none
  Caller      : general
 
Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::Utils::ConversionSupport
Definition: ConversionSupport.pm:39
Bio::EnsEMBL::Utils::Logger::warning
public Boolean warning()
Bio::EnsEMBL::Utils::Logger::is_component
public is_component()
Bio::EnsEMBL::Utils::Logger::logfile
public logfile()
Bio::EnsEMBL::Utils::Logger::init_progress
public init_progress()
Bio::EnsEMBL::Utils::Logger::mem
public String mem()
Bio::EnsEMBL::Utils::Logger::log_warning
public log_warning()
Bio::EnsEMBL::Utils::Logger::date_and_mem
public String date_and_mem()
Bio::EnsEMBL::Utils::Logger::loglevel
public loglevel()
Bio::EnsEMBL::Utils::Logger::log_progressbar
public log_progressbar()
Bio::EnsEMBL::Utils::Logger::log_error
public log_error()
Bio::EnsEMBL::Utils::Logger::logappend
public logappend()
Bio::EnsEMBL::Utils::Logger::log
public log()
Bio::EnsEMBL::Utils::Logger::runtime
public runtime()
Bio::EnsEMBL::Utils::Logger::log_verbose
public log_verbose()
Bio::EnsEMBL::Utils::Logger::logauto
public logauto()
Bio::EnsEMBL::Utils::Logger::info
public info()
Bio::EnsEMBL::Utils::Logger::log_filehandle
public Filehandle log_filehandle()
Bio::EnsEMBL::Utils::Logger::log_stamped
public log_stamped()
Bio::EnsEMBL::Utils::Logger::create_auto_logfile
public create_auto_logfile()
Bio::EnsEMBL::Utils::Logger::log_progress
public log_progress()
Bio::EnsEMBL::Utils::Logger::finish_log
public Boolean finish_log()
Bio::EnsEMBL::Utils::Logger::time_and_mem
public time_and_mem()
Bio::EnsEMBL::Utils::Logger::error
public void error()
Bio::EnsEMBL::Utils::Logger::debug
public Boolean debug()
Bio::EnsEMBL::Utils::Logger::warning_count
public Int warning_count()
Bio::EnsEMBL::Utils::Logger::logpath
public logpath()
Bio::EnsEMBL::Utils::Logger::log_generic
public Boolean log_generic()
Bio::EnsEMBL::Utils::Logger::init_log
public Filehandle init_log()
Bio::EnsEMBL::Utils::Logger::log_auto_id
public log_auto_id()
Bio::EnsEMBL::Utils::Logger::extract_log_identifier
public extract_log_identifier()
Bio::EnsEMBL::Utils::Logger::date
public String date()