Skip to main content

logging decorator

This project provides a logging decorator that allows you to put a wrapper on your functions to log their output. Inspired by cross cutting technologies I thought I'd do the same for python

from Baubles.Logger import Logger

logger = Logger()


@logger.warning
def handler(*args, **kwargs):
	return 'in handler (%s, %s)' % (args, kwargs)


class Test(object):
	@logger.debug
	def __init__(self):
		pass

	@logger.debug
	def __del__(self):
		pass

	@logger.info
	def run(self, a, k=None):
		return 'kk'

	@logger.handle
	def noFail(self, arg1, arg2, kwargs1=None):
		logger.info('did not fail')
		return True

	@logger.handle
	def willFail(self, arg1, arg2, kwargs1=None):
		raise Exception('failed and logged')
		return False

	@logger.handle(handler=handler)
	def doFail(self, arg1, arg2, kwargs1=None):
		raise Exception('failed and handled')
		return False

test and examples

from Baubles.Logger import main

main()

ItsChristmas

Pythonista Colour Console

for the Pythonista fans, make a file called pythonista_startup.py with the following snippet and pop it in your site-packages directory.

import console
console.clear()
console.set_font('Menlo',11)

from Baubles.Colours import Colours
colours = Colours(colour=True)
colours.start()

import sys
sys.stdout.write(''.join([
	colours.Green,
	'started',
	colours.Off,
	'\n'
]))

Metadata

Release files for Baubles 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Baubles 1.6
File Size Uploaded
Baubles-1.6.tar.gz 5.2 kB Details

Release files / Baubles-1.6.tar.gz

Download URL Baubles-1.6.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
23c246b0b28d294a8fd291e9a1d0cc4043f8fb2335ed1b82ce62dfe0ee74ce72
BLAKE2b-256 checksum
How to use checksums
bb98d54e1f411cacfd28d888f02c8b36ceca048fa0ab8eb0faaccf4fa5009c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.15+

Release history Release notifications | RSS feed

This release

1.6 This release

1 release file

1.4

1 release file

1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page