#!/usr/bin/perl

use strict;
use warnings;
use LATMOS::Accounts::Log;
use Getopt::Long;
use Pod::Usage;

=head1 NAME

    la-log-test - Tools to LATMOS::Account loggin system

=head1 SYNOPSIS

    la-log-test [options]

=cut

GetOptions(
    'c|config=s' => \my $config,
    'l|level=s'  => \my $level,
    'mail=s'     => \my $mail,
    'help'       => sub { pod2usage(0) },
) or pod2usage();

=head1 OPTIONS

=over 4

=item -c|--config configdir

Use this configuration directory instead of the default one.

=item -l|--level level

Set the log level

=item --mail email

Setup log error sent to email at end of execution

=back

=cut

$level ||= 'LA_INFO';

if ($mail) {
    la_set_log(mail => $mail);
}

my $numlevel = eval "LATMOS::Accounts::Log::$level()";

la_log($numlevel, "message from $0 ($level)");
