From 10a5b04eb4cf274ecd888568f8d21646daedb804 Mon Sep 17 00:00:00 2001 From: mangeimarkus <> Date: Sun, 17 Nov 2013 16:59:09 +0000 Subject: [PATCH] - Added some log messages git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4237 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- contrib/YAF/CHANGED | 4 ++++ contrib/YAF/FHEM/01_YAF.pm | 18 +++++++++++++----- contrib/YAF/FHEM/YAF/YAFApplication.pm | 19 +++++++++++++++++++ contrib/YAF/FHEM/YAF/YAFConfig.pm | 2 +- contrib/YAF/FHEM/YAF/YAFWidgets.pm | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 contrib/YAF/FHEM/YAF/YAFApplication.pm diff --git a/contrib/YAF/CHANGED b/contrib/YAF/CHANGED index 7c6bf8842..14dcf773b 100644 --- a/contrib/YAF/CHANGED +++ b/contrib/YAF/CHANGED @@ -1,3 +1,7 @@ +0.45: +- Added some Logs for debug (mangei.markus) + +older version 0.45: - Added JSON librabry as alternative for JSON::XS (mangei.markus) - Added webcam widget (marcproe) - path to background image is now configurable via the YAF interface (marcproe) diff --git a/contrib/YAF/FHEM/01_YAF.pm b/contrib/YAF/FHEM/01_YAF.pm index ecdaefc6e..c0923e7ed 100644 --- a/contrib/YAF/FHEM/01_YAF.pm +++ b/contrib/YAF/FHEM/01_YAF.pm @@ -50,7 +50,7 @@ use vars qw($FW_dir); sub YAF_Request($@); my $fhem_url; -my $yaf_version=0.41; +my $yaf_version=0.45; my $yafw_encoding = "UTF-8"; my $mp = AttrVal("global", "modpath", "."); my $yaf_www_directory = $mp."/FHEM/YAF/www"; @@ -127,7 +127,9 @@ sub YAF_LoadResource($@) { # Extension my @filenameSplitted = split(/\./, $filename); my $extension = $filenameSplitted[scalar(@filenameSplitted)-1]; - #Log 1,"YAF_LoadResource absoluteFilePath $absoluteFilePath filename $filename extension $extension"; + + # Log for debug + Log 1,"YAF_LoadResource: absoluteFilePath = $absoluteFilePath; filename = $filename; extension = $extension"; # Datei laden if ((-f $absoluteFilePath) && open($fh, "<", $absoluteFilePath)) { @@ -140,7 +142,7 @@ sub YAF_LoadResource($@) { else { # Datei nicht gefunden Log 1,"YAF_LoadResource: file $filename not found"; - return YAF_NotFound($absoluteFilePath); + return YAF_NotFound($absoluteFilePath, $file_local); } close($fh); @@ -206,7 +208,6 @@ sub YAF_define ($@) { sub YAF_LoadView($@) { my ($view) = @_; - YAF_Print("ddd"); return ("text/html; charset=$yafw_encoding", $FW_RET); } @@ -222,7 +223,10 @@ sub YAF_Request ($@) { my ($htmlarg) = @_; # %20 durch Leerzeichen ersetzen $htmlarg =~ s/%20/ /g; - + + # Log for debug + Log 1,"YAF_Request: htmlarg: $htmlarg"; + # GET Parameter my @params = split(/\?/, $htmlarg); @@ -390,7 +394,9 @@ sub YAF_Request ($@) { YAF_Print("1"); } else { + Log 3, "Error in saving config"; YAF_Print("0"); + } } else { @@ -438,6 +444,8 @@ sub YAF_Request ($@) { sub YAF_NotFound{ my $file = $_[0]; YAF_Print("Error 404: $file"); + YAF_Print("\n"); + YAF_Print("Absolute path: $file\n"); YAF_Print("\n"); return ("text/html; charset=$yafw_encoding", $FW_RET); } diff --git a/contrib/YAF/FHEM/YAF/YAFApplication.pm b/contrib/YAF/FHEM/YAF/YAFApplication.pm new file mode 100644 index 000000000..420596992 --- /dev/null +++ b/contrib/YAF/FHEM/YAF/YAFApplication.pm @@ -0,0 +1,19 @@ +package YAF::YAFApplication; + +use strict; +use warnings; + +use base "YAFWebserver::YAFApplicationBase"; + +sub new { + my $class = shift; + my $self = YAFWebserver::YAFApplicationBase->new; + + # routes + $self->add_route("^/Error\$", "YAFWebserver::Controller::DebugRequest", "show_error"); + $self->add_route("^/.*\$", "YAFWebserver::Controller::DebugRequest", "show_debug"); + + bless $self, $class; +} + +1; \ No newline at end of file diff --git a/contrib/YAF/FHEM/YAF/YAFConfig.pm b/contrib/YAF/FHEM/YAF/YAFConfig.pm index ff0bbf498..c0c40f5dc 100644 --- a/contrib/YAF/FHEM/YAF/YAFConfig.pm +++ b/contrib/YAF/FHEM/YAF/YAFConfig.pm @@ -27,7 +27,7 @@ package main; use strict; use warnings; -my $yaf_version=0.41; +my $yaf_version=0.45; my %fhemwidgets; my %fhemviews; diff --git a/contrib/YAF/FHEM/YAF/YAFWidgets.pm b/contrib/YAF/FHEM/YAF/YAFWidgets.pm index d938cb7d6..ce63550fd 100644 --- a/contrib/YAF/FHEM/YAF/YAFWidgets.pm +++ b/contrib/YAF/FHEM/YAF/YAFWidgets.pm @@ -27,7 +27,7 @@ package main; use strict; use warnings; -my $yaf_version = 0.41; +my $yaf_version = 0.45; my $mp = AttrVal("global", "modpath", "."); my $yaf_dir = $mp."/FHEM/YAF/"; my @yaf_widgets;