aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net/IMAP/InterIMAP.pm
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-03 22:03:48 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-03 22:03:48 +0100
commit84f0560ed8fb3002581b1bf96d7ea51b3136d72f (patch)
treedee9394eea2807b31a1828995f641c938e25fced /lib/Net/IMAP/InterIMAP.pm
parent29c40a4e26775e072c2ebcd57dcddbe66725cdbd (diff)
Log and debug messages: don't prefix with a ':' for nameless clients.
Diffstat (limited to 'lib/Net/IMAP/InterIMAP.pm')
-rw-r--r--lib/Net/IMAP/InterIMAP.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm
index c5b45aa..7af04e7 100644
--- a/lib/Net/IMAP/InterIMAP.pm
+++ b/lib/Net/IMAP/InterIMAP.pm
@@ -523,9 +523,10 @@ sub log($@) {
return unless @_;
$self->logger(@_) if defined $self->{'logger-fd'} and defined $self->{'logger-fd'}->fileno
and $self->{'logger-fd'}->fileno != fileno STDERR;
- my $prefix = defined $self->{name} ? $self->{name} : '';
+ my $prefix = $self->{name} // '';
$prefix .= "($self->{_SELECTED})" if $self->{_STATE} eq 'SELECTED';
- print STDERR $prefix, ': ', @_, "\n";
+ $prefix .= ': ' unless $prefix eq '';
+ print STDERR $prefix, @_, "\n";
}
sub logger($@) {
my $self = shift;
@@ -536,9 +537,10 @@ sub logger($@) {
my ($s, $us) = Time::HiRes::gettimeofday();
$prefix = POSIX::strftime("%b %e %H:%M:%S", localtime($s)).".$us ";
}
- $prefix .= defined "$self->{name}" ? $self->{name} : '';
+ $prefix .= $self->{name} // '';
$prefix .= "($self->{_SELECTED})" if $self->{_STATE} eq 'SELECTED';
- $self->{'logger-fd'}->say($prefix, ': ', @_);
+ $prefix .= ': ' unless $prefix eq '';
+ $self->{'logger-fd'}->say($prefix, @_);
}