| 1 | package TaskPipe::LoggerManager::Settings; | ||
| 2 | |||
| 3 | 42 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 42 | with 'MooseX::ConfigCascade'; | |
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | TaskPipe::LoggerManager::Settings - settings for the L<TaskPipe::LoggerManager> module | ||
| 9 | |||
| 10 | =head1 METHODS | ||
| 11 | |||
| 12 | =over | ||
| 13 | |||
| 14 | =item log_mode | ||
| 15 | |||
| 16 | Whether to log to file or to the screen (or both). Choices are | ||
| 17 | |||
| 18 | C<file> - always log to file | ||
| 19 | C<screen> - always log to screen | ||
| 20 | C<shell> - log to file if command is run in the background, but screen otherwise | ||
| 21 | C<both> - log to both screen and file | ||
| 22 | C<none> - don't log at all | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | 42 | has log_mode => (is => 'ro', isa => 'Str', default => 'shell'); | |
| 27 | |||
| 28 | |||
| 29 | =item log_level | ||
| 30 | |||
| 31 | The log level to report. Options are C<TRACE>, C<DEBUG>, C<INFO>, C<WARN>, C<ERROR> and C<FATAL>. TaskPipe uses Log::Log4perl - check the documentation this module's CPAN entry for more information. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | 42 | has log_level => (is => 'ro', isa => 'Str', default => 'INFO'); | |
| 36 | |||
| 37 | |||
| 38 | =item log_file_access | ||
| 39 | |||
| 40 | whether to C<append> or C<overwrite> the log file with each run | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 42 | has log_file_access => (is => 'ro', isa => 'Str', default => 'append'); | |
| 45 | |||
| 46 | |||
| 47 | =item log_file_pattern | ||
| 48 | |||
| 49 | The logging pattern to use with files. See the documentation for Log::Log4perl for more information | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | 42 | has log_file_pattern => (is => 'ro', isa => 'Str', default => '[%d] (%p) %N: %m%n'); | |
| 54 | |||
| 55 | |||
| 56 | =item log_screen_pattern | ||
| 57 | |||
| 58 | The logging pattern to use when displaying to terminal. See the documentation for Log::Log4perl for more information | ||
| 59 | |||
| 60 | =cut | ||
| 61 | |||
| 62 | 42 | has log_screen_pattern => (is => 'ro', isa => 'Str', default => '%-5p%6J%6P%3h%N %m%n'); | |
| 63 | |||
| 64 | |||
| 65 | =item log_screen_colors | ||
| 66 | |||
| 67 | The colors to use when displaying to terminal. This maps C<Log::Log4perl> entities (C<%p>, C<%m> etc.) to ansi color values (C<blue>, C<bold while>, C<yellow on_blue> etc.) | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | has log_screen_colors => (is => 'ro', isa => 'HashRef', default => sub {{ | ||
| 72 | 2968 | ▶ | p => { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 73 | TRACE => 'bold green', | ||
| 74 | DEBUG => 'white', | ||
| 75 | INFO => 'bold white', | ||
| 76 | WARN => 'yellow', | ||
| 77 | ERROR => 'red', | ||
| 78 | FATAL => 'bold red' | ||
| 79 | }, | ||
| 80 | d => 'blue', | ||
| 81 | J => 'blue on_white', | ||
| 82 | i => 'white on_blue', | ||
| 83 | P => 'white on_cyan', | ||
| 84 | h => 'red on_white', | ||
| 85 | N => 'bold blue' | ||
| 86 | 42 | }}); | |
| 87 | |||
| 88 | =item log_dir_format | ||
| 89 | |||
| 90 | The format of the logging directory | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | 42 | has log_dir_format => (is => 'ro', isa => 'Str', default => '<% job_id %>-<% cmd %>'); | |
| 95 | |||
| 96 | |||
| 97 | =item log_filename_format | ||
| 98 | |||
| 99 | The format of the log file to write | ||
| 100 | |||
| 101 | =back | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | 42 | has log_filename_format => (is => 'ro', isa => 'Str', default => 'Thread-<% thread_id %>.log'); | |
| 106 | |||
| 107 | |||
| 108 | =head1 AUTHOR | ||
| 109 | |||
| 110 | Tom Gracey <tomgracey@gmail.com> | ||
| 111 | |||
| 112 | =head1 COPYRIGHT AND LICENSE | ||
| 113 | |||
| 114 | Copyright (c) Tom Gracey 2018 | ||
| 115 | |||
| 116 | TaskPipe is free software, licensed under | ||
| 117 | |||
| 118 | The GNU Public License Version 3 | ||
| 119 | |||
| 120 | =cut | ||
| 121 | |||
| 122 | |||
| 123 | 42 | __PACKAGE__->meta->make_immutable; | |
| 124 | 42 | 1; | |
| 125 | __END__ | ||