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)));
return \%active;
} else {
print "You haven't initialized get_outputs";
$self->do_log('LOG_WARNING',"Output list not defined yet. Try 'get_outputs()' first");
return \{};
}
@ -251,23 +250,10 @@ sub do_log($self, $level, $msg, $die=0)
{
my $min = $self->{verbose} || 5;
# Journald is borked. Just don't bother logging
return 0;
if ($self->{daemon}) {
#use Log::Journald qw(send);
#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);
}
# Journald module is borked. Just print to STDOUT and SystemD will catch it
$msg = '(FATAL) ' . $msg if ($die);
if (ERROR->{$level} >= $min) {
printf("%11s %s\n", $level, $msg);
}
if ($die) {
$self->clean();