Acrux

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    * Bug #159996463 registered. See https://www.cpantesters.org/cpan/report/57536a76-6c61-1014-b81f-8fc30e238516
    * Bug fixed with Plugin::Log: incorrect access to config value
    * Acrux::Log: added the file method

0.10 Tue 30 Jun 2026 12:36:09 MSK
    * Changed default logging backend from syslog to STDERR.
      Applications relying on implicit syslog logging should explicitly
      configure file => "syslog:" (or file => "@") instead.
    * Added explicit logging targets:
        file => "stdout:"
        file => "stderr:"
        file => "syslog:"
    * Short aliases are also supported:
        "-"  => stdout
        "="  => stderr
        "@"  => syslog
    * If a log file cannot be opened, logging automatically falls back to
      STDERR instead of aborting initialization.

0.09 Sat 27 Jun 2026 19:12:29 MSK
    * Added Acrux::Util::parse_words function

0.08 Tue 20 Jan 2026 19:29:10 MSK
    * Project relicensed from the Perl 5 dual license to the Artistic License 2.0
    * Added Acrux::Digest::Damm module with checkdigit/digest methods

lib/Acme/Crux.pm  view on Meta::CPAN

    }
    unless (File::Spec->file_name_is_absolute($configfile)) {
        $self->{configfile} = $configfile = File::Spec->rel2abs($configfile);
    }

    # Log file
    my $logfile = $self->{logfile};
    unless (defined($logfile) && length($logfile)) {
        $self->{logfile} = $logfile = File::Spec->catfile($logdir, sprintf("%s.log", $moniker));
    }
    if ($logfile !~ /^(?:[@=-]|\:?(?:stdout|stderr|syslog)\:?)$/) {
        unless (File::Spec->file_name_is_absolute($logfile)) {
            $self->{logfile} = $logfile = File::Spec->rel2abs($logfile);
        }
    }

    # PID file
    my $pidfile = $self->{pidfile};
    unless (defined($pidfile) && length($pidfile)) {
        $self->{pidfile} = $pidfile = File::Spec->catfile($rundir, sprintf("%s.pid", $moniker));
    }

lib/Acrux/Log.pm  view on Meta::CPAN

    # Using STDOUT
    my $log = Acrux::Log->new(file => 'stdout'); # or 'stdout:', ':stdout'
    my $log = Acrux::Log->new(file => '-');

    # Using STDOUT (handle)
    my $log = Acrux::Log->new(
            handle => IO::Handle->new_from_fd(fileno(STDOUT), "w")
        );

    # Using STDERR (default since 0.10)
    my $log = Acrux::Log->new(file => 'stderr'); # or 'stderr:', ':stderr'
    my $log = Acrux::Log->new(file => '=');

    # Using syslog
    my $log = Acrux::Log->new(file => 'syslog'); # or 'syslog:', ':syslog'
    my $log = Acrux::Log->new(file => '@');

    # Customize minimum log level
    my $log = Acrux::Log->new(level => 'warn');

    # Log messages

lib/Acrux/Log.pm  view on Meta::CPAN

C<local7>, C<lpr>, C<mail>, C<news>, C<syslog>, C<user> and C<uucp>

Default: C<user> (Sys::Syslog::LOG_USER)

See also L<Sys::Syslog/Facilities>

=head2 file

    file => '/var/log/myapp.log'
    file => 'stdout' # 'stdout:', ':stdout', '-'
    file => 'stderr' # 'stderr:', ':stderr', '='
    file => 'syslog' # 'syslog:', ':syslog', '@'

Log file path used by "handle"

B<Compatibility note:>

Prior to version 0.10, Acrux::Log implicitly used syslog when no logging
destination was specified.
Starting with version 0.10, the default destination is STDERR.

lib/Acrux/Log.pm  view on Meta::CPAN

        }

        # Use STDOUT handle
        elsif ($file =~ /^\:?stdout\:?$/i or $file eq '-') {
            $self->{provider} = "handle";
            $self->{handle} = IO::Handle->new_from_fd(fileno(STDOUT), "w");
            $self->{file} = "stdout";
        }

        # Use STDERR handle
        elsif ($file =~ /^\:?stderr\:?$/i or $file eq '=') {
            $self->{provider} = "handle";
            $self->{handle} = IO::Handle->new_from_fd(fileno(STDERR), "w");
            $self->{file} = "stderr";
        }

        # Open log file handle
        else {
            $self->{provider} = "file";
            $self->{handle} = IO::File->new($file, ">>");
            unless (defined $self->{handle}) { # Error
                printf STDERR "Can't open log file \"%s\" for writing (%s). Logging to STDERR instead.\n",
                    $file, $!;
                $self->{provider} = "handle";



( run in 2.347 seconds using v1.01-cache-2.11-cpan-f52f0507bed )