From: Guilhem Moulin Date: Thu, 3 Mar 2016 21:03:48 +0000 (+0100) Subject: Log and debug messages: don't prefix with a ':' for nameless clients. X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=84f0560ed8fb3002581b1bf96d7ea51b3136d72f;p=interimap.git Log and debug messages: don't prefix with a ':' for nameless clients. --- 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, @_); }