LoxBerry::Web::logfile_button_html

LoxBerry::Web::logfile_button_html( %params );

 

Returns HTML code for a logfile button. This function accepts parameters from LoxBerry::Log to open the lastest logfile, and also directly a logfile name.

LoxBerry Compatibility

This function is available starting with LoxBerry V1.2.1. If you use that function, set this minimum version in your plugin.cfg.

The function returns a string with HTML code that directly can be printed to your webpage.

The function accepts a LOGFILE parameter to directly give a filename, or the NAME parameter to use the log group name used in combination with the LoxBerry::Log logging feature.

If you use the NAME parameter, the button will open the latest logfile available for the named group.

To give parameters to the function, use named parameters.

Parameter

Case sensitivity

All parameter names are case-sensitive and written in capital letters.

ParameterOptionalUsage
LOGFILE (x) LOGFILE is the fully filename of the logfile that should be opened.

The LOGFILE parameter is mutually exclusive to the NAME parameter. If you use LOGFILE, the NAME parameter is ignored.
NAME (x) NAME is the loggroup name used with LoxBerry::Log. If you have created a logfile with LoxBerry::Log::new( name ⇒ 'daemon'), use NAME ⇒ 'daemon' to open the latest daemon log.

The NAME parameter is mutually exlusive to the LOGFILE parameter. If you use the LOGFILE parameter, the NAME parameter is ignored.
PACKAGE x Package is not required in the case of a plugin. By default, this is (like with LoxBerry::Log) the $lbpplugindir-Variable.

Core-Developers have to use the PACKAGE parameter.
LABEL x By default, LoxBerry labels the button with the language-specific "Logfile" phrase.

To change the default label, use the LABEL parameter.
DATA_MINIx By default, the function uses the jQuery Mobile tag data-mini="true". To have the full-sized button, send DATA_MINI ⇒ "0".
DATA_ICONx By default, the function uses LoxBerry's default icon from jQuery Mobile, "action" (data-icon="action"). To change the icon, send the icon name here.

Return value

Returns a string that is the HTML code for the Logfile button. Simply print the result of the function to your webpage.

Returns undef, if the call failed.

Usage

use LoxBerry::Web;
 
 
# Show a specific filename:
print LoxBerry::Web::logfile_button_html( LOGFILE => "$lbplogdir/mylogfile.log" );
 
 
# Show the latest log of LoxBerry::Log of a named group
print LoxBerry::Web::logfile_button_html ( NAME => 'daemon' );
 
 
# Modify the label and the icon of the button:
print LoxBerry::Web::logfile_button_html ( NAME => 'daemon', LABEL => 'Open my logfile', DATA_ICON => 'arrow-r' );