<s> from MobileDevice import * <EOL> from amdevice import * <EOL> from plistservice import * <EOL> import os <EOL> class Syslog ( object ) : <EOL> u'''<STR_LIT>''' <EOL> def __init__ ( self , amdevice ) : <EOL> self . s = amdevice . start_service ( AMSVC_SYSLOG_RELAY ) <EOL> if self . s is None : <EOL> raise RuntimeError ( u'<STR_LIT>' , AMSVC_SYSLOG_RELAY ) <EOL> def disconnect ( self ) : <EOL> os . close ( self . s ) <EOL> def read ( self , length = <NUM_LIT> ) : <EOL> u'''<STR_LIT>''' <EOL> return os . read ( self . s , length ) <EOL> def register_argparse_syslog ( cmdargs ) : <EOL> import argparse <EOL> import sys <EOL> def cmd_syslog ( args , dev ) : <EOL> sl = Syslog ( dev ) <EOL> while True : <EOL> msg = sl . read ( ) <EOL> if msg is None : <EOL> break <EOL> sys . stdout . write ( msg ) <EOL> sl . disconnect ( ) <EOL> syslogcmd = cmdargs . add_parser ( <EOL> u'<STR_LIT>' , <EOL> help = u'<STR_LIT>' <EOL> ) <EOL> syslogcmd . set_defaults ( func = cmd_syslog ) </s>
