<s> from gevent . monkey import patch_all <EOL> patch_all ( ) <EOL> from logging import getLogger , StreamHandler <EOL> from django . core . management . base import BaseCommand <EOL> from gnotty . conf import settings <EOL> from gnotty . models import IRCMessage <EOL> class ModelLogger ( StreamHandler ) : <EOL> """<STR_LIT>""" <EOL> def emit ( self , record ) : <EOL> IRCMessage . objects . create ( server = record . server , <EOL> channel = record . channel , <EOL> nickname = record . nickname , <EOL> message = record . msg , <EOL> join_or_leave = record . join_or_leave ) <EOL> class Command ( BaseCommand ) : <EOL> option_list = BaseCommand . option_list + tuple ( settings . option_list ) <EOL> def handle ( self , * args , ** options ) : <EOL> getLogger ( "<STR_LIT>" ) . addHandler ( ModelLogger ( ) ) <EOL> settings . parse_args ( ) <EOL> from gnotty . server import serve_forever <EOL> serve_forever ( django = True ) </s>
