Hallo weismat,
use strict;
use warnings;
use Data::TreeDumper;
use Log::Dispatch::FileRotate;
my $file = Log::Dispatch::FileRotate->new(
name => 'file1',
min_level => 'info',
filename => 'Somefile.log',
mode => 'append' ,
size => 10,
max => 6,
);
print DumpTree($file);
blessed in 'Log::Dispatch::FileRotate'
|- debug = 0 [S1]
|- LDF = blessed in 'Log::Dispatch::File' [OH2]
| |- autoflush = 1 [S3]
| |- close = 0 [S4]
| |- fh = *Log::Dispatch::File::FH [S5]
| |- filename = Somefile.log [S6]
| |- level_names [A7]
| | |- 0 = debug [S8]
| | |- 1 = info [S9]
| | |- 2 = notice [S10]
| | |- 3 = warning [S11]
| | |- 4 = error [S12]
| | |- 5 = critical [S13]
| | |- 6 = alert [S14]
| | `- 7 = emergency [S15]
| |- level_numbers [H16]
| | |- alert = 6 [S17]
| | |- crit = 5 [S18]
| | |- critical = 5 [S19]
| | |- debug = 0 [S20]
| | |- emerg = 7 [S21]
| | |- emergency = 7 [S22]
| | |- err = 4 [S23]
| | |- error = 4 [S24]
| | |- info = 1 [S25]
| | |- notice = 2 [S26]
| | `- warning = 3 [S27]
| |- max_level = 7 [S28]
| |- min_level = 1 [S29]
| |- mode = >> [S30]
| |- name = file1 [S31]
| `- permissions = undef [S32]
|- level_names [A33]
| |- 0 = debug [S34]
| |- 1 = info [S35]
| |- 2 = notice [S36]
| |- 3 = warning [S37]
| |- 4 = error [S38]
| |- 5 = critical [S39]
| |- 6 = alert [S40]
| `- 7 = emergency [S41]
|- level_numbers [H42]
| |- alert = 6 [S43]
| |- crit = 5 [S44]
| |- critical = 5 [S45]
| |- debug = 0 [S46]
| |- emerg = 7 [S47]
| |- emergency = 7 [S48]
| |- err = 4 [S49]
| |- error = 4 [S50]
| |- info = 1 [S51]
| |- notice = 2 [S52]
| `- warning = 3 [S53]
|- lf = ./.Somefile.log.LCK [S54]
|- max = 6 [S55]
|- max_level = 7 [S56]
|- min_level = 1 [S57]
|- name = file1 [S58]
|- new = 1 [S59]
|- params [H60]
| |- filename = Somefile.log [S61]
| |- max = 6 [S62]
| |- min_level = info [S63]
| |- mode = append [S64]
| |- name = file1 [S65]
| `- size = 10 [S66]
`- size = 10 [S67]
Soweit ich das erkennen kann, könntest du mit
$file->{params}->{min_level} = $new_min_level;
$file->{params}->{max_level} = $new_max_level;
die Parameter ändern... falls nicht, dann schau doch mal in die Sourcen.
Gruss,
opi
Edit: was ich aber noch hinzufügen möchte ist, dass es nicht sehr ratsam
ist, auf diese Weise das Objekt zu verändern. Am besten wäre natürlich,
wenn du den Autor des Moduls um die Erweiterung bittest (vielleicht sogar
einen Patch schreibst, wenn du dich dazu fähig hälst) oder aber du findest
dich mit dem Zustand ab. :)\n\n
<!--EDIT|opi|1173971843-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.