Commits

Herbert Breunung committed 159beaf

cleaning the logging

Comments (0)

Files changed (4)

lib/Kephra/App/Bar/Document.pm

 	$set_active = 1                          unless defined $set_active;
 
 	unless ($new_panel->isa('Wx::Panel')) { # put panel under a none-panel
-		$new_panel = Kephra::App::Panel->new( $self, $new_panel);# if ($position == 0 or $label);
+		$new_panel = Kephra::App::Panel->new( $self, $new_panel) if ($position == 0 or $label);
 		#$new_panel->Reparent( $self )
 	}
 	else { $new_panel->Reparent( $self ) }

lib/Kephra/App/Dialog/Documentation.pm

 	return $cache if defined $cache;
 	my $dialog = $cache = Wx::Dialog->new(
 		Kephra::App::Dialog::_parent(shift), -1,
-		$Kephra::NAME . ' '.$Kephra::VERSION .' User Guide and Documentation'
+		$Kephra::NAME . ' '.$Kephra::VERSION .' User Guide and Documentation',
+		[-1, -1],[800, 600],
 	);
 	$dialog;
 }

lib/Kephra/Document.pm

 has panel => (
 	is  => 'rw',
 	isa => sub {Kephra::Log::error("$_[0] is no panel")
-				unless ref $_[0] eq 'Wx::Panel' or ref $_[0] eq 'Kephra::App::Panel'},
+				unless ref $_[0] eq 'Wx::Panel' or ref $_[0] eq 'Kephra::App::Panel'
+				},
 );
 has file_path    => ( is  => 'rw', );
 has file_dir     => ( is  => 'rw', );

lib/Kephra/Log.pm

 sub init {}
 
 sub warning { 
-	my $msg = timestamp() . ' ' . sender() . ': '. $_[0];
+	my $msg = message( $_[0] );
 	warn $msg;
 	Kephra::API::output('warn', $msg);
 }
 
-sub error { die timestamp(), ' ', sender(), ': ', $_[0] }
+sub error { 
+	my $msg = message( $_[0] );
+	die $msg;
+}
 
-sub timestamp { sprintf("[%02u:%02u:%02u]", (localtime)[2,1,0]) }
-sub sender    { ( caller(2) )[0] . '::' . ( caller(2) )[3] }
+sub message     { timestamp() . ' ' . calling_sub(3) . ': "'. $_[0].'"' }
+sub timestamp   { sprintf("[%02u:%02u:%02u]", (localtime)[2,1,0]) }
+sub calling_sub { ( caller($_[0]) )[0] . '::' . ( caller($_[0]) )[3] } 
 
 1;