Log directly to STDOUT

This commit is contained in:
John Mertz 2024-04-19 15:10:03 -06:00
parent 7e43f9f600
commit b0e1ead2b3
1 changed files with 4 additions and 18 deletions

View File

@ -144,7 +144,6 @@ sub get_active($self)
$self->do_log('LOG_WARNING',"No outputs detected.") unless (scalar(keys(%active))); $self->do_log('LOG_WARNING',"No outputs detected.") unless (scalar(keys(%active)));
return \%active; return \%active;
} else { } else {
print "You haven't initialized get_outputs";
$self->do_log('LOG_WARNING',"Output list not defined yet. Try 'get_outputs()' first"); $self->do_log('LOG_WARNING',"Output list not defined yet. Try 'get_outputs()' first");
return \{}; return \{};
} }
@ -251,23 +250,10 @@ sub do_log($self, $level, $msg, $die=0)
{ {
my $min = $self->{verbose} || 5; my $min = $self->{verbose} || 5;
# Journald is borked. Just don't bother logging # Journald module is borked. Just print to STDOUT and SystemD will catch it
return 0; $msg = '(FATAL) ' . $msg if ($die);
if ($self->{daemon}) { if (ERROR->{$level} >= $min) {
#use Log::Journald qw(send); printf("%11s %s\n", $level, $msg);
#send(
#PRIORITY => ERROR->{$level},
#MESSAGE => $msg,
#PERL_PACKAGE => 'Sway Wallpapers'
#) || warn "Could not send log ($level $msg): $!";
if ($die) {
$msg = '(FATAL) ' . $msg;
exit(1);
}
} else {
if (ERROR->{$level} >= $min) {
printf("%11s %s\n", $level, $msg);
}
} }
if ($die) { if ($die) {
$self->clean(); $self->clean();