What's New in V1.2.1

SDK-Feature- und Bugfix-Release

Konkrete Version: 1.2.1.4 

In dieser Version wurden hauptsächlich Weiterentwicklungen in den Perl- und PHP-SDKs durchgeführt, die vorrangig für Plugin-Entwickler, und natürlich in weiterer Folge für alle Benutzer nützlich sind.

Languages

Thanks to zmata (Czech) and madito (Spanish) for the ongoing translation support for all the changes we've made in the English base language!

Für Benutzer

Alle Benachrichtigungen auf einmal löschen

Wer gerne seine Benachrichtigungen sammelt, kann diese jetzt auf einmal löschen.

LoxBerry reduziert übrigens bereits jetzt einmal pro Woche die Benachrichtigungen auf 20 pro Plugin/Widget.

Für Plugin-Entwickler

The future present of logging

With LoxBerry V1.2.1 we finalized the main concept for logging/logfiles within LoxBerry. This concept is now finished and available for Perl, PHP and even Bash!

Here is a short summary of the concept:

  • Creating logfiles should be as easy and comfortable as possible
  • It should work with Perl, PHP and Bash with the same (or nearly the same) interface
  • A plugin developer should not need to care about visuals to enable debug mode or log-levels, nor to create a log viewer
  • A plugin developer should not need to care about the logfile name and logfile location at all.

Some wording:

  • Whenever you see the term "package", this is the name of your plugin (concretely it is the $lbpplugindir variable). Inside the code of a plugin, you never need to send the package name, as it is defaulted to $lbpplugindir. Only LoxBerry-Core developers need to define the package, or in some special situations.
  • Whenever you see the term "name", this is the group name something belongs to, inside of your plugin. As example, you may have a webinterface, and a daemon script. The names could be 'Webinterface' and 'Daemon'.
  • The loglevel is the priority/severity of messages. It ranges from 0 to 7 (coming from syslog priorities), where 7 is debug, and 0 is emergency. For notifications ("notify") we only use 3=Error (red bullet) and 6=Info (blue bullet). For logfiles, we use 7=Debug to 2=Critical. The loglevel is set by the user in the plugin management. In your script you simply say, "this is a debug message", "this is an error message", … and the SDK will filter the messages by the user defined loglevel.

When you create a logfile with the Perl-, PHP- or Bash SDK, you don't need to assign a filename. Instead, you only define the group name, like name ⇒ 'Daemon'. The LoxBerry SDK automatically assigns a file, that you usually never need to know (but of course you can query it). All logging statements, like LOGINF, LOGDEB, LOGERR log to this file (that you don't need to know (Zwinkern) )

To provide a way to show the logfile or logfiles, we have functions to show a logfile button or a loglist button (logfile_button_html and loglist_button_html). The button brings the user to the lastest logfile or the list of logfiles (you still don't know (Zwinkern) ). You may "tell" the button, that only a specific group name should be shown. You don't need the filename at all.

LoxBerry automatically keeps track of all logfiles you've created with the Perl/PHP/Bash SDK. The buttons will bring the users to the correct logfile.

If you want to see what logfiles your LoxBerry creates, you can try this link: http://loxberry/admin/system/tools/showalllogs.cgi (at least V1.2.1 required).

LBLog - LoxBerry Standard-Logging-Modul für PHP

Das Perl-Modul LoxBerry::Log zum einfachen Erstellen von Logfiles in Perl-Plugins wird seit LB 1.0.0 mitgeliefert und auch von den System-Widgets verwendet.

Nun liefern wir mit LB 1.2.1 dieses Funktionsset für PHP nach. Der Funktionsumgang und die Parameter sind gleich bzw. fast gleich wie bei Perl. Logfiles werden mit einem Aufruf initialisiert, und mit einfachen Kommandos (LOGOK, LOGERR, LOGDEB usw.) werden Logeinträge geschrieben. Dabei wird die Benutzer-Einstellung des Loglevels aus der Plugin-Verwaltung verwendet (siehe CUSTOM_LOGLEVELS=true in der plugin.cfg). Plugin-Entwickler brauchen sich nicht um die Speicherung der Loglevel-Einstellung und um die Filterung kümmern. 

PHP-Logging-Modul: http://www.loxwiki.eu/x/PgLgAQ

Perl und PHP - get_storage_html

Seit LoxBerry ohne Shell-Zugriff Netzwerk- und USB-Laufwerke einbinden kann, besteht in Plugins der Bedarf, für Benutzer und Plugin-Entwickler die Auswahl dieser Pfade einfach zu gestalten.

Mit der Funktion get_storage_html (Perl und PHP) wird ein Funktionsaufruf bereitgestellt, der ein fertiges Dropdown (und optional Pfadeingabe) -HTML inklusive JavaScript liefert, das nur noch ge-printed bzw. ge-echoed werden muss. Über Parameter kann gesteuert werden, welche Möglichkeiten der Benutzer in diesem Control hat. 

Das Ergebnis der Benutzer-Auswahl wird direkt im Formular mitgesandt, oder kann in JavaScript verarbeitet werden.

Eine Umstellung von bestehenden Pfad-Formularfeldern auf diese Funktion ist in der Regel mit wenigen Codezeilen erledigt.

Siehe LoxBerry::Storage::get_storage_html (Perl) bzw. LBStorage::get_storage_html (PHP).

Perl und PHP - logfile_button_html

A small and candy function to display a logfile button in your webpage.

logfile_button_html supports a specific filename to open, or can be used with the LoxBerry::Log / LBLog parameter NAME to open a generic logfile created by the LoxBerry Logging functions.

This feature works for all logfiles (using or not using LoxBerry::Log / LBLog).

See LoxBerry::Web::logfile_button_html (Perl) and LBWeb::logfile_button_html (PHP).

Perl and PHP - loglist_button_html and loglist_url

LoxBerry V1.2.1 introduces a database to track your logfiles, created with the Perl / PHP Logging SDK.

It completes the vision to completely remove the thinking about physical filenames - The plugin developer creates a logfile with the LoxBerry::Log / LBLog constructor, simply defining a "name" (that is not a filename) but a group (e.g. your 'Daemon' or your 'Webinterface'). For the plugin developer, there is no need to know filenames. The Logging SDK cares about everything. 

This abstraction concept uses a PACKAGE (that always is your plugin and only needed for Core-developers) and a NAME (that is a kind of group inside of your plugin).

loglist_button_html (Perl and PHP) creates a button that opens a list of all of your logfiles of your plugin. This only works with logfiles created by the SDK.

With the NAME parameter, you can filter to a specific group (e.g. 'Daemon') to only show logfile of your daemon. 

loglist_url does not return a button, but the link url to the list. You may use this link in your navigation bar. It also support to filter by NAME.

Perl: LoxBerry::Web::loglist_button_html and LoxBerry::Web::loglist_url

PHP: LBWeb::loglist_button_html and LBWeb::loglist_url

Weitere Verbesserungen und Korrekturen

  • E-Mails "SECURITY infomation for loxberry", "user loxberry is not in sudoers", die öfter während eines LoxBerry Update getriggert wurden, wurden adressiert. Sollten weiterhin solche Meldungen kommen, bitte einen neuen Issue öffnen.
  • Perl und PHP - Die LOGSTART-Routine des Log-Objekts (Perl and PHP) loggt nun automatisch die installierte Plugin- und LoxBerry-Versionsnummer, sowie die Plattform-Tags und den aktuellen Loglevel.
  • Plugin-Installation - Prüfung auf Minimum- und Maximum-Version: Ein Plugin-Entwickler kann die Mindest-LoxBerry-Version einstellen, die für die Installation seines Plugins installiert sein muss. Diese Prüfung hat bisher nicht funktioniert… (Zwinkern) 
  • Perl: get_storage: Zusätzlich zu den Funktionen get_usbstorage und get_netshares gibt es jetzt eine generelle Funktion get_storage, die zusammengefasst alle Datenpfade (inklusive des Plugin-Data-Verzeichnisses) zurückliefert. 
  • Housekeeping für Logfiles 1: Logrotate läuft nun nicht mehr täglich, sondern stündlich, und verwendet restriktivere Einstellungen zum Aufbewahren bzw. Bereinigen von Logfiles.
  • Housekeeping für Logfiles 2: LoxBerry bereinigt die Logdateien des Systems und aller Plugins, wenn der freie Speicherplatz in den Log-Verzeichnissen unter 25% ist.