Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: How to "disguise" caller

by menth0l (Monk)
on Feb 10, 2011 at 14:58 UTC ( #887466=note: print w/replies, xml ) Need Help??

in reply to Re: How to "disguise" caller
in thread How to "disguise" caller

Well, I got several objects of different classes which produce some data which is stored in a container object. When all workers finish, container renders reports and logs them. E.g.
$container->do_FooBarWork(); # Foo::Bar work $container->do_BazWhoWork(); # Baz::Who work $container->createReport(); # renders report for each worker $container->dumpReport(); # dumps all reports to log
Now all reports are logged by Container::dumpReport() method and thus log4perl can't tell which class produced which output. But if container class knew who produced what then it could log it "on behalf" of worker object. In other words i want to "tie" logged result to class that created it.

Replies are listed 'Best First'.
Re^3: How to "disguise" caller
by moritz (Cardinal) on Feb 10, 2011 at 16:17 UTC

    This might be an easier solution:

    Have a method in each of the worker classes that does the logging regarding its activity, and then call these methods from the container class. That way the reporting also becomes customizable by overriting the reporting method in an inheriting class.

    The container can still do some summary logging, if necessary.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://887466]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2016-10-25 22:03 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.