Why not just use Python's standard logging module?
http://docs.python.org/lib/module-logging.html
Venky.
On Fri, Jun 20, 2008 at 11:36:44AM -0700, Dan Price wrote:
>
> I set out to do something about the useless verbose output you get when
> you do an image-update. However I quickly realized that there might be
> two problems here: we need a user-friendly verbose output, and we might
> want to have some less user-friendly debug output. I'm still formulating
> what to do about verbose output.
>
> But I got further with the debug output. The idea I had is mostly about
> enabling us to debug problems encountered by end users. If it was also
> a developer productivity tool that would be a bonus.
>
> So to start, I've moved some of the verbose output into a debug mode,
> which one can activate either by setting PKG_DEBUG or with --debug. I've
> also left room in the api to direct the debug output to a file. In
> addition, I've added in some debug output; my hope is that we can get
> users to submit debug output when reporting problems, as a way to help us
> more rapidly diagnose issues when the traceback is insufficient.
>
> To make a debug call, you do this:
>
> from pkg.misc import debug
> debug("something")
>
> To initialize debugging, you do this:
>
> from pkg.misc import debug_init
> debug_init(sys.stderr, "DEBUG")
>
> Thoughts, Opinions? I tried to be super-lightweight and super-simple, but
> would be open to a linker style debug architecture (where you'd set
> PKG_DEBUG=a,b,c -- see LD_DEBUG in ld.so.1(1)).
>
> Another potential avenue to explore would be to add in support for python
> statement tracing (see e.g.
> http://www.dalkescientific.com/writings/diary/archive/2005/04/20/tracing_python_code.html)
>
> Here's an example of an image-update in which one package (SUNWpool)
> is downrev. It's a case where we do reasonably well: A bunch of
> binaries delivered by this package do not change between B86 and B90,
> including usr/kernel/drv/pool, pooladm, poolcfg, poolbind, etc.
>
> # PKG_DEBUG=1 pkg image-update
> DEBUG# debugging enabled (PKG_DEBUG environment variable)
> DEBUG# argv: /usr/bin/pkg image-update
> DEBUG# PKG_CLIENT_TIMEOUT=30
> DEBUG# PKG_TIMEOUT_MAX=4
> DEBUG# http_proxy=
> DEBUG# PKG_IMAGE=/tmp/z
> DEBUG# Image Root: /tmp/z
> DEBUG# -- Package Plans --
> DEBUG# pkg:/[EMAIL PROTECTED],5.11-0.86:20080426T175946Z -> pkg:/[EMAIL
> PROTECTED],5.11-0.90:20080604T145017Z
> DEBUG# depend . -> pkg:/[EMAIL PROTECTED]
> DEBUG# depend . -> pkg:/[EMAIL PROTECTED]
> DEBUG# set fmri -> fmri
> DEBUG# license SUNWpoolr.copyright -> SUNWpoolr.copyright
> DEBUG# license SUNWpool.copyright -> SUNWpool.copyright
> DEBUG# file usr/lib/amd64/libpool.so.1 ->
> usr/lib/amd64/libpool.so.1
> DEBUG# file usr/lib/libpool.so.1 -> usr/lib/libpool.so.1
> DEBUG# file usr/lib/amd64/llib-lpool.ln ->
> usr/lib/amd64/llib-lpool.ln
> DEBUG# file usr/lib/llib-lpool.ln -> usr/lib/llib-lpool.ln
> DEBUG# file usr/lib/rcm/modules/SUNW_pool_rcm.so ->
> usr/lib/rcm/modules/SUNW_pool_rcm.so
> DEBUG# legacy SUNWpool -> SUNWpool
> DEBUG# legacy SUNWpoolr -> SUNWpoolr
> DEBUG# depend pkg:/[EMAIL PROTECTED] -> .
> DEBUG# depend pkg:/[EMAIL PROTECTED] -> .
> DEBUG# -- End Package Plans --
> DOWNLOAD PKGS FILES XFER (MB)
> SUNWpool 0/1 0/7 0.00/0.45
> PHASE ACTIONS
> Removal Phase 2/2
> Update Phase 10/10
> Install Phase 2/2
>
> Your comments appreciated,
>
> -dp
>
> --
> Daniel Price - Solaris Kernel Engineering - [EMAIL PROTECTED] -
> blogs.sun.com/dp
> _______________________________________________
> pkg-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss