Bot-Cobalt

 view release on metacpan or  search on metacpan

t/02_logger/01_output_file.t  view on Meta::CPAN

);

is( $output->file, $test_log_path, 'file() returns log path' );

is( $output->perms, 0666, 'perms() returned 0666' );

ok( $output->_write("This is a test string"), '_write()' );

ok( -e $test_log_path, 'Log file was created' );

my $contents = do { local (@ARGV, $/) = $test_log_path ; <> };

chomp $contents;
cmp_ok( $contents, 'eq', "This is a test string" );

## FIXME test mode / perms ?

$test_log_path->remove
  or warn "temporary log at $test_log_path disappeared before unlink";

ok( 

t/02_logger/03_output.t  view on Meta::CPAN

    $output->_write('info', [caller(0)], "Testing", "things"), 
    '_write()' 
  );

  close STDOUT
}

ok( $stdout, "Logged to STDOUT" );

ok( 
  do { local (@ARGV, $/) = $test_log_path; <> }, 
  "Logged to File"
);

## FIXME test with modified time_format / log_format ?

my $tobj;
ok( $tobj = $output->get('myterm'), 'get()' );
isa_ok( $tobj, 'Bot::Cobalt::Logger::Output::Term' );

cmp_ok( $output->del('myterm', 'myfile'), '==', 2, 'del() 2 objects' );

t/02_logger/04_logger.t  view on Meta::CPAN

    error
  /,
);

ok( $logobj->set_level('debug'), 'set_level debug' );
ok( $logobj->debug("Testing", "debug"), 'debug()' );
ok( $logobj->info("Testing", "info"), 'info()' );
ok( $logobj->warn("Testing", "warn"), 'warn()' );
ok( $logobj->error("Testing", "error"), 'error()' );

my $contents = do { local (@ARGV, $/) = $test_log_path ; <> };

cmp_ok( split(/\n/, $contents), '==', 4, 'logfile has expected line count' );

unlink $test_log_path;

## FIXME
##  test caller details
##  test log_format / time_format triggers and constructor opts
##   (output obj's settings should change also)

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.504 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )