[gimp-perl] Rip out Gimp::logger. Bug 728164
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] Rip out Gimp::logger. Bug 728164
- Date: Wed, 23 Apr 2014 05:12:20 +0000 (UTC)
commit fed8f78b2e8817a57962bccaab88d7aff35b26f9
Author: Ed J <m8r-35s8eo mailinator com>
Date: Mon Apr 14 10:31:08 2014 +0100
Rip out Gimp::logger. Bug 728164
Gimp.pm | 60 +++-------------------------------------------------------
Gimp/Fu.pm | 5 +---
Makefile.PL | 2 +-
Net/Net.pm | 3 +-
TODO | 9 +------
5 files changed, 9 insertions(+), 70 deletions(-)
---
diff --git a/Gimp.pm b/Gimp.pm
index 04924ef..4642a30 100644
--- a/Gimp.pm
+++ b/Gimp.pm
@@ -185,47 +185,6 @@ EOF
}
}
-# section on logging
-
-my @log;
-
-sub format_msg {
- $_=shift;
- "$_->[0]: $_->[2] ".($_->[1] ? "($_->[1])":"");
-}
-
-sub _initialized_callback {
- if (@log) {
- my $oldtrace = set_trace(0);
- unless ($in_net || $in_query || $in_quit || $in_init) {
- for(@log) {
- Gimp->message(format_msg($_)) if $_->[3];
- }
- }
- Gimp->_gimp_append_data ('gimp-perl-log', map join("\1",@$_)."\0",@log);
- @log=();
- set_trace($oldtrace);
- }
-}
-
-# message
-# function
-# fatal
-sub logger {
- my %args = @_;
- $args{message} = "unknown message" unless defined $args{message};
- $args{function} = $function unless defined $args{function};
- $args{function} = "" unless defined $args{function};
- $args{fatal} = 1 unless defined $args{fatal};
- push(@log,[$basename,@args{'function','message','fatal'}]);
- print STDERR format_msg($log[-1]),"\n" if !($in_query || $in_init || $in_quit) || $Gimp::verbose;
- _initialized_callback if initialized();
-}
-
-sub die_msg {
- logger(message => substr($_[0],0,-1), fatal => 1, function => 'ERROR');
-}
-
# section on error-handling
# this needs to be improved
@@ -236,20 +195,12 @@ sub quiet_die {
unless($no_SIG) {
$SIG{__DIE__} = sub {
unless ($^S || !defined $^S || $in_quit) {
- die_msg $_[0];
+ warn $_[0];
initialized() ? &quiet_die : exit quiet_main();
} else {
die $_[0];
}
};
-
- $SIG{__WARN__} = sub {
- unless ($in_quit) {
- warn $_[0];
- } else {
- logger(message => substr($_[0],0,-1), fatal => 0, function => __"WARNING");
- }
- };
}
# section on callbacks
@@ -266,9 +217,8 @@ sub callback {
if ($type eq "-run") {
local $function = shift;
local $in_run = 1;
- _initialized_callback;
@cb = cbchain(qw(run lib), $function);
- die_msg __"required callback 'run' not found\n" unless @cb;
+ die __"required callback 'run' not found\n" unless @cb;
# returning list of last func's return values
my @retvals;
for (@cb) {
@@ -277,9 +227,8 @@ sub callback {
@retvals;
} elsif ($type eq "-net") {
local $in_net = 1;
- _initialized_callback;
@cb = cbchain(qw(run net), $function);
- die_msg __"required callback 'net' not found\n" unless @cb;
+ die __"required callback 'net' not found\n" unless @cb;
# returning list of last func's return values
my @retvals;
for (@cb) {
@@ -288,9 +237,8 @@ sub callback {
@retvals;
} elsif ($type eq "-query") {
local $in_query = 1;
- _initialized_callback;
@cb = cbchain(qw(query));
- die_msg __"required callback 'query' not found\n" unless @cb;
+ die __"required callback 'query' not found\n" unless @cb;
for (@cb) { &$_ }
} elsif ($type eq "-quit") {
local $in_quit = 1;
diff --git a/Gimp/Fu.pm b/Gimp/Fu.pm
index 0ec41cd..a153ef2 100644
--- a/Gimp/Fu.pm
+++ b/Gimp/Fu.pm
@@ -290,8 +290,6 @@ Gimp::on_query {
],
$results,
);
-
- Gimp::logger(message => 'OK', function => $function, fatal => 0);
}
};
@@ -341,8 +339,7 @@ sub register($$$$$$$$$;@) {
$function=~/^[0-9a-z_]+(-ALT)?$/ or carp(__"$function: function name contains unusual characters, good
style is to use only 0-9, a-z and _");
- Gimp::logger message => __"function name contains dashes instead of underscores",
- function => $function, fatal => 0
+ carp __"function name contains dashes instead of underscores\n"
if $function =~ y/-//;
my $perl_sub = sub {
diff --git a/Makefile.PL b/Makefile.PL
index 21e9199..85cccea 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -63,6 +63,6 @@ WriteMakefile(
'VERSION_FROM' => 'Gimp.pm',
'EXE_FILES' => [ map { "utils/$_" } qw(gimpdoc xcftopnm embedxpm scm2perl) ],
'realclean' => { FILES => "Makefile" },
- 'clean' => { FILES => "Makefile.old stamp-h Gimp/Config.pm" },
+ 'clean' => { FILES => "Makefile.old stamp-h Gimp/Config.pm Gimp/IFiles.pm" },
$pkg->get_makefile_vars,
);
diff --git a/Net/Net.pm b/Net/Net.pm
index d4ab049..13501af 100644
--- a/Net/Net.pm
+++ b/Net/Net.pm
@@ -240,7 +240,6 @@ sub gimp_init {
}
$initialized = 1;
- Gimp::_initialized_callback;
warn "$$-Finished gimp_init(@_)" if $Gimp::verbose;
}
@@ -258,7 +257,7 @@ sub gimp_main {
eval { Gimp::callback("-net") };
if($@ && $@ ne "IGNORE THIS MESSAGE\n") {
chomp(my $exception = $@);
- Gimp::logger(message => $exception, fatal => 1, function => 'DIE');
+ warn "$0 exception: $exception\n";
gimp_end;
-1;
} else {
diff --git a/TODO b/TODO
index e2b6065..cdf1bcd 100644
--- a/TODO
+++ b/TODO
@@ -14,13 +14,8 @@ Items as of 2014-03-31 (by Ed J)
* Add a gtk2 gimp-perl console - cf http://registry.gimp.org/node/29348
- gimp/plug-ins/script-fu/script-fu-console.c
* Test menupath <File> etc
-* "IGNORE THIS MESSAGE" - $in_top - what??
-* die causes "Server-Warning" with duplicate exception message when
- Gimp::Fu in net mode dies. Gimp::_initialized_callback is sending
- @log to gimp_message and appending to 'gimp-perl-log' - don't see what
- benefit to either of those. Suspect _icb, logger, and PS flags are
- obsolete - replace with verbose
-* set_trace may also be obsolete
+* "IGNORE THIS MESSAGE" - $in_top - whole quiet_die probably needs to go too
+* PS flags are obsolete - replace with verbose - set_trace may also be obsolete
Legacy notes from Seth Burgess:
* Win32 port
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]