Coder Social home page Coder Social logo

undead's Introduction

undead

Dead Easy POSIX Daemons for Python!


#!/usr/bin/python
import undead

@undead
def my_daemon_process():
    """ This function will be daemonized. """
    from time import sleep
    while True:
        sleep(10)

Installation

pip install undead

Settings

undead.name

Name of the logger and process.

Default: __name__ of decorated callable

undead.pidfile

Path to pidfile.

Default: ~/.{undead.name}/{undead.name}.pid

undead.log_level

Log level.

Default: "WARNING"

undead.process_name

The name of the process (that shows up in ps etc.)

Default: None (No manipulation of process name)

Example

import undead

undead.name = "my-first-daemon"
undead.process_name = "leDeamon"

@undead
def my_daemon_process():
    """ This function will be daemonized. """
    # ...

Logging within the decorated handler

Just add log to your decorated signature, and the logger will be passed down. Log away captain!

import undead

@undead
def i_am_undead(log):
    log.warning("I'm warning you!")
    log.info("Soap, 2 for $1.99")

The logfile will be created in ~/.i_am_undead

License

MIT

undead's People

Contributors

waawal avatar sente avatar

Watchers

Brent Hoover avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.