Abhijeet R
2012-Nov-14 09:29 UTC
[Puppet Users] Sending output to debug level log from custom parser function
Hi, I created a custom function by reading the doc from here http://docs.puppetlabs.com/guides/custom_functions.html It''s a function to return proper filepath for a specific node by looking at various stuff like facter, absolute path location etc. Now, I have a requirement to log the actual path returned by the function in /var/log/puppet/puppet.log. How can I do that? Does this question better suited for puppet-dev or it can be done easily? I want to use the function that''s used to send debug log in custom parser function. -- Cheers, Abhijeet R http://blog.abhijeetr.com -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jeff McCune
2012-Nov-14 16:41 UTC
Re: [Puppet Users] Sending output to debug level log from custom parser function
On Wed, Nov 14, 2012 at 4:29 AM, Abhijeet R <abhijeet.1989@gmail.com> wrote:> Hi, > > I created a custom function by reading the doc from here > http://docs.puppetlabs.com/guides/custom_functions.html > > It''s a function to return proper filepath for a specific node by looking at > various stuff like facter, absolute path location etc. Now, I have a > requirement to log the actual path returned by the function in > /var/log/puppet/puppet.log. > > How can I do that? Does this question better suited for puppet-dev or it can > be done easily? I want to use the function that''s used to send debug log in > custom parser function.You can simply use `debug "Hello World!"` inside the block passed to the `newfunction` method. You can see how the built in template() function logs debug messages at: https://github.com/puppetlabs/puppet/blob/3.0.1/lib/puppet/parser/functions/template.rb#L11 Hope this helps, -Jeff -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Abhijeet R
2012-Nov-16 15:24 UTC
Re: [Puppet Users] Sending output to debug level log from custom parser function
Thanks. That worked. :) On Wed 14 Nov 2012 10:11:10 PM IST, Jeff McCune wrote:> On Wed, Nov 14, 2012 at 4:29 AM, Abhijeet R <abhijeet.1989@gmail.com> wrote: >> Hi, >> >> I created a custom function by reading the doc from here >> http://docs.puppetlabs.com/guides/custom_functions.html >> >> It''s a function to return proper filepath for a specific node by looking at >> various stuff like facter, absolute path location etc. Now, I have a >> requirement to log the actual path returned by the function in >> /var/log/puppet/puppet.log. >> >> How can I do that? Does this question better suited for puppet-dev or it can >> be done easily? I want to use the function that''s used to send debug log in >> custom parser function. > > You can simply use `debug "Hello World!"` inside the block passed to > the `newfunction` method. You can see how the built in template() > function logs debug messages at: > > https://github.com/puppetlabs/puppet/blob/3.0.1/lib/puppet/parser/functions/template.rb#L11 > > Hope this helps, > -Jeff >-- Cheers, Abhijeet R http://blog.abhijeetr.com -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.