Skip to end of metadata
Go to start of metadata

@notifications = LBLog::get_notifications([$package], [$name]);


Reads the notifications, optional filtered by $package or $package and $name. Returns an array of notifications, containing a labeled array of all attributes of a notification.

LoxBerry 1.0.3

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

Use the prefix LBLog:: to access the function.

The $package is the owner of the notification. To get the notifications of your plugin, use the $lbpplugindir variable or the LBPPLUGINDIR constant.

Inside the package, you can filter by the name using the  $name parameter. This must be equal (case-sensitive) to the $name you have specified on setting the notification.



This is, where the message belongs to. In a plugin, always use the variable $lbpplugindir or constant LBPPLUGINDIR.

Omiting the $package and $name parameter will return all notifications (including system notifications).

Filters by the notification group name, this notifications belongs to.

Case sensitivity

The content of $package and $name is case-sensitive. If you set the name => "Daemon", you have to query "Daemon".

Return value

The function returns an array with all found notifications. Every element in the array contains a labeled array with the notification attributes. The labels are case-sensitive, therefore you have to read e.g. the $notification['NAME'] (not $notification['name']).

Each notification also contains all attributes that where set by notify_ext. 

Hash KeyContent
PACKAGEPackage name
NAMEGroup name
CONTENTRAWThe message of the notification
CONTENTHTMLThe message HTML-encoded. Linefeeds are converted to <br>.
SEVERITY3 is an error, 6 is information. Other levels are reserved for future use.
<attribute1>This are your own attributes inserted by notify_ext
<attribute2>This are your own attributes inserted by notify_ext
System added

This attributes are automatically added to your notification

You can use them the same way as the other attributes.

DATEISOThis is the ISO 6801 time format (2018-02-18T14:34:56). Use Time::Piece to convert.
DATESTRThis is a date string in the format %d.%m.%Y %H:%M
KEYThe key is a unique key that represents this notification.
_ISPLUGINThis parameter is set, if notify or notify_ext detected a plugin notification
_ISSYSTEMThis parameter is set, if notify or notify_ext detected a system notification


require_once "loxberry_log.php";
# Filtered to a specific notification group
$notifications = LBLog::get_notifications( $lbpplugindir, "notificationname");
foreach ($notifications as $notification ) {
    if ( $notification['SEVERITY'] == 3 ) {
        echo "An error occured at {$notification['DATESTR']}.";
    } elseif ( $notification['SEVERITY'] == 6 ) {
        echo "There is an information at {$notification['DATESTR']}.";

# Check if a specific attribute, set by notify_ext, is present:
foreach ($notifications as $notification ) {
    if (! isset($notification['myownattribute']) ) {
	# Attribute myownattribute is available
	# do stuff with it
  • No labels