Skip Menu |

This queue is for tickets about the Log-Dispatch-Tk CPAN distribution.

Report information
The Basics
Id: 120730
Status: resolved
Priority: 0/
Queue: Log-Dispatch-Tk

People
Owner: Nobody in particular
Requestors: TMCMEEKI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: 1.8



Subject: Application control of log level prefix in LogText widget
Hi there, firstly I love this widget, and expect to make good use of it! Right now the log() operation will issue a mandatory "level prefix" in the text widget (refer to the "info" and "debug" lines below): info 2017/03/24 14:44:21 INFO dispatchtk2.pl hello debug 2017/03/24 14:44:21 DEBUG dispatchtk2.pl hello It would be my preference to be able to control the display of the prefix, such that it would be able to display the following: 2017/03/24 14:43:36 INFO dispatchtk2.pl hello 2017/03/24 14:43:36 DEBUG dispatchtk2.pl hello The code fragment is as follows: sub log { my ($dw,%params) = @_; $dw->insert('end',"$params{level}\n", [$params{level}, 'label' ]); $dw->insert('end',"$params{message}\n", [$params{level}, 'message' ]); } Can I suggest that you add a conditional statement to allow the prefix to be avoided, e.g. if ($params{show_prefix}) { $dw->insert('end',"$params{level}\n", [$params{level}, 'label' ]); } And have the show_prefix attribute default to 1 to preserve existing behavior. In that way, I could override show_prefix to 0 following widget creation, and thus avoid the mandatory prefix. Hope to hear from you soon!
[ oh boy, it's been a while ... ] On Fri Mar 24 04:56:12 2017, TMCMEEKI wrote: Show quoted text
> Hi there, firstly I love this widget, and expect to make good use of > it!
I'm glad to find that my older modules are still useful :-) Show quoted text
> It would be my preference to be able to control the display of the > prefix, such that it would be able to display the following: > > 2017/03/24 14:43:36 INFO dispatchtk2.pl hello > 2017/03/24 14:43:36 DEBUG dispatchtk2.pl hello
ok, that makes sense Show quoted text
> The code fragment is as follows: > > sub log > { > my ($dw,%params) = @_; > > $dw->insert('end',"$params{level}\n", > [$params{level}, 'label' ]); > $dw->insert('end',"$params{message}\n", > [$params{level}, 'message' ]); > } > > Can I suggest that you add a conditional statement to allow the prefix > to be avoided, e.g. > > if ($params{show_prefix}) { > $dw->insert('end',"$params{level}\n", > [$params{level}, 'label' ]); > } > > And have the show_prefix attribute default to 1 to preserve existing > behavior.
I'd rather have an option that defaults to 0. Would you mind to have a 'hide_prefix' option that defaults to 0 ? (instead of 'show_prefix' option) All the best PS: I'll need a few days to dig up the repo of this module (which may still be a svn or even a cvs repo :-/ )
On Sat Mar 25 15:01:23 2017, DDUMONT wrote: Show quoted text
> [ oh boy, it's been a while ... ] > > On Fri Mar 24 04:56:12 2017, TMCMEEKI wrote:
> > Hi there, firstly I love this widget, and expect to make good use of > > it!
> > I'm glad to find that my older modules are still useful :-) >
> > It would be my preference to be able to control the display of the > > prefix, such that it would be able to display the following: > > > > 2017/03/24 14:43:36 INFO dispatchtk2.pl hello > > 2017/03/24 14:43:36 DEBUG dispatchtk2.pl hello
> > ok, that makes sense >
> > The code fragment is as follows: > > > > sub log > > { > > my ($dw,%params) = @_; > > > > $dw->insert('end',"$params{level}\n", > > [$params{level}, 'label' ]); > > $dw->insert('end',"$params{message}\n", > > [$params{level}, 'message' ]); > > } > > > > Can I suggest that you add a conditional statement to allow the > > prefix > > to be avoided, e.g. > > > > if ($params{show_prefix}) { > > $dw->insert('end',"$params{level}\n", > > [$params{level}, 'label' ]); > > } > > > > And have the show_prefix attribute default to 1 to preserve existing > > behavior.
> > I'd rather have an option that defaults to 0. Would you mind to have a > 'hide_prefix' option that defaults to 0 ? (instead of 'show_prefix' > option) > > > All the best > > PS: I'll need a few days to dig up the repo of this module (which may > still be a svn or even a cvs repo :-/ )
Yep, happy with "hide_prefix". Thanks, and good luck finding the source repository!
On Tue Mar 28 00:10:11 2017, TMCMEEKI wrote: Show quoted text
> On Sat Mar 25 15:01:23 2017, DDUMONT wrote:
> > [ oh boy, it's been a while ... ] > > > > On Fri Mar 24 04:56:12 2017, TMCMEEKI wrote:
> > > Hi there, firstly I love this widget, and expect to make good use > > > of > > > it!
> > > > I'm glad to find that my older modules are still useful :-) > >
> > > It would be my preference to be able to control the display of the > > > prefix, such that it would be able to display the following: > > > > > > 2017/03/24 14:43:36 INFO dispatchtk2.pl hello > > > 2017/03/24 14:43:36 DEBUG dispatchtk2.pl hello
> > > > ok, that makes sense > >
> > > The code fragment is as follows: > > > > > > sub log > > > { > > > my ($dw,%params) = @_; > > > > > > $dw->insert('end',"$params{level}\n", > > > [$params{level}, 'label' ]); > > > $dw->insert('end',"$params{message}\n", > > > [$params{level}, 'message' ]); > > > } > > > > > > Can I suggest that you add a conditional statement to allow the > > > prefix > > > to be avoided, e.g. > > > > > > if ($params{show_prefix}) { > > > $dw->insert('end',"$params{level}\n", > > > [$params{level}, 'label' ]); > > > } > > > > > > And have the show_prefix attribute default to 1 to preserve > > > existing > > > behavior.
> > > > I'd rather have an option that defaults to 0. Would you mind to have > > a > > 'hide_prefix' option that defaults to 0 ? (instead of 'show_prefix' > > option) > > > > > > All the best > > > > PS: I'll need a few days to dig up the repo of this module (which may > > still be a svn or even a cvs repo :-/ )
> > Yep, happy with "hide_prefix". Thanks, and good luck finding the > source repository!
thanks, tested it. looks good.
this ticket can be closed.