Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


russell.jurney at gmail

Jul 1, 2009, 2:15 AM

Post #1 of 5 (565 views)
Permalink
Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio

I just created a simple trait for the Catalyst::Log that uses OS X's
'say' utility to log error messages to audio, such that the computer
will say them to you. My eyes tire of reading through 100s of lines
of debug output, so now sometimes I will have the computer simply talk
to me.

Its not in CPAN yet, but its simple enough:

-------

package Catalyst::TraitFor::Log::Audio;

use Moose::Role;

sub speak
{
my ($self, $txt) = @_;

return unless $txt;

system("say $txt &") if $ENV{'SPEAK'};
}

1;

-----

In MyApp.pm, after setup():

Moose::Util::apply_all_roles(MyApp->log,
'Catalyst::TraitFor::Log::Audio');

----

In a controller: $foo='bar'; $c->log->speak('Hello world, the value of
foo is $foo');

---

If ENV 'SPEAK' is set, it will talk to you. Works like a charm. mst/
t0m told me how to do it. Will get around to CPAN'ing it this week.
Anyone aware of a cross platform library that will do this kind of
speech stuff? There is no reason to stop here if this is useful to
people - could play tones depending on state, warnings, etc.

Russell Jurney
russell.jurney[at]gmail.com


russell.jurney at gmail

Jul 1, 2009, 2:20 AM

Post #2 of 5 (528 views)
Permalink
Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio [In reply to]

I just created a simple trait for the Catalyst::Log that uses OS X's
'say' utility to log error messages to audio, such that the computer
will say them to you. My eyes tire of reading through 100s of lines
of debug output, so now sometimes I will have the computer simply talk
to me.

Its not in CPAN yet, but its simple enough:

-------

package Catalyst::TraitFor::Log::Audio;

use Moose::Role;

sub speak
{
my ($self, $txt) = @_;

return unless $txt;

system("say $txt &") if $ENV{'SPEAK'};
}

1;

-----

In MyApp.pm, after setup():

Moose::Util::apply_all_roles(MyApp->log,
'Catalyst::TraitFor::Log::Audio');

----

In a controller: $foo='bar'; $c->log->speak('Hello world, the value of
foo is $foo');

---

If ENV 'SPEAK' is set, it will talk to you. Works like a charm. mst/
t0m told me how to do it. Will get around to CPAN'ing it this week.
Anyone aware of a cross platform library that will do this kind of
speech stuff? There is no reason to stop here if this is useful to
people - could play tones depending on state, warnings, etc.

Russell Jurney
russell.jurney[at]gmail.com


ijw at cack

Jul 1, 2009, 7:20 AM

Post #3 of 5 (520 views)
Permalink
Re: Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio [In reply to]

2009/7/1 Russell Jurney <russell.jurney[at]gmail.com>:
> I just created a simple trait for the Catalyst::Log that uses OS X's 'say'
> utility to log error messages to audio, such that the computer will say them
> to you.  My eyes tire of reading through 100s of lines of debug output, so
> now sometimes I will have the computer simply talk to me.

Top tip: making a noise is incredibly useful for test and
small-audience servers. Whenever anything goes wrong, make the
computer make a sound, and you can ask whoever has a problem straight
away what they were doing, etc. - before they forget, and often while
they're still trying to work out what to do.

(The server we had that did this coughed discreetly when a problem
came up. This was great until the winter cold season came on...)

--
Ian.

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


russell.jurney at gmail

Jul 1, 2009, 5:15 PM

Post #4 of 5 (503 views)
Permalink
Re: Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio [In reply to]

Yes, it also helps me determine the state of my controllers in the
test server without straining my eyes reading the debug output. And I
have MyApp.pm system("say 'go' &"); also, which tells me that the test
server just reloaded the content and the server is ready for testing
again, each time I save a file and it auto-restarts. Before I would
have to change windows and watch it until I saw that it was ready.

Its actually quite pleasant :)

Russell Jurney
russell.jurney[at]gmail.com




On Jul 1, 2009, at 10:20 AM, Ian Wells wrote:

> 2009/7/1 Russell Jurney <russell.jurney[at]gmail.com>:
>> I just created a simple trait for the Catalyst::Log that uses OS
>> X's 'say'
>> utility to log error messages to audio, such that the computer will
>> say them
>> to you. My eyes tire of reading through 100s of lines of debug
>> output, so
>> now sometimes I will have the computer simply talk to me.
>
> Top tip: making a noise is incredibly useful for test and
> small-audience servers. Whenever anything goes wrong, make the
> computer make a sound, and you can ask whoever has a problem straight
> away what they were doing, etc. - before they forget, and often while
> they're still trying to work out what to do.
>
> (The server we had that did this coughed discreetly when a problem
> came up. This was great until the winter cold season came on...)
>
> --
> Ian.
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


russell.jurney at gmail

Jul 1, 2009, 5:16 PM

Post #5 of 5 (506 views)
Permalink
Re: Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio [In reply to]

Oh, btw - its up on CPAN now: http://search.cpan.org/~rjurney/Catalyst-TraitFor-Log-Audio-0.01/lib/Catalyst/TraitFor/Log/Audio.pm

I'll add Linux support and queueing soon.

Russell Jurney
russell.jurney[at]gmail.com




On Jul 1, 2009, at 10:20 AM, Ian Wells wrote:

> 2009/7/1 Russell Jurney <russell.jurney[at]gmail.com>:
>> I just created a simple trait for the Catalyst::Log that uses OS
>> X's 'say'
>> utility to log error messages to audio, such that the computer will
>> say them
>> to you. My eyes tire of reading through 100s of lines of debug
>> output, so
>> now sometimes I will have the computer simply talk to me.
>
> Top tip: making a noise is incredibly useful for test and
> small-audience servers. Whenever anything goes wrong, make the
> computer make a sound, and you can ask whoever has a problem straight
> away what they were doing, etc. - before they forget, and often while
> they're still trying to work out what to do.
>
> (The server we had that did this coughed discreetly when a problem
> came up. This was great until the winter cold season came on...)
>
> --
> Ian.
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.