#NEWLINE# @ staticmethod #NEWLINE# def cmdlineParse( ) : #NEWLINE# #INDENT# 'Parse command line config options.' #NEWLINE# parser = OptionParser ( ) #NEWLINE# parser . add_option ( '-c' , '--config' , dest = 'config_file' , metavar = 'FILE' , help = 'Read config from FILE.' ) #NEWLINE# parser . add_option ( '-i' , '--stdin' , dest = 'stdin_config' , default = False , action = 'store_true' , help = 'Read config from Stdin.' ) #NEWLINE# parser . add_option ( '-r' , '--run-once' , dest = 'run_once' , action = 'store_true' , help = 'Send all data and exit.' ) #NEWLINE# parser . add_option ( '-n' , '--no-daemon' , dest = 'no_daemon' , action = 'store_true' , help = 'Do not daemonize.' ) #NEWLINE# parser . add_option ( '-d' , '--debug' , dest = 'debug' , action = 'store_true' , help = 'Print debug messages.' ) #NEWLINE# parser . add_option ( '-t' , '--tag' , dest = 'tag' , metavar = 'TAG' , help = 'Set tag of sending messages as TAG.' ) #NEWLINE# parser . add_option ( '-T' , '--type' , dest = 'log_type' , metavar = 'TYPE' , default = 'syslog' , help = 'Set type of files as TYPE(default: %default).' ) #NEWLINE# parser . add_option ( '-f' , '--watchfile' , dest = 'watchfiles' , action = 'append' , metavar = 'FILE' , help = 'Add FILE to watchlist.' ) #NEWLINE# parser . add_option ( '-s' , '--host' , dest = 'host' , metavar = 'HOSTNAME' , help = 'Set destination as HOSTNAME.' ) #NEWLINE# parser . add_option ( '-p' , '--port' , dest = 'port' , type = 'int' , default = 514 , metavar = 'PORT' , help = 'Set remote port as PORT (default: %default).' ) #NEWLINE# ( options , args ) = parser . parse_args ( ) #NEWLINE# if ( options . config_file and options . stdin_config ) : #NEWLINE# #INDENT# parser . error ( 'You must not set both options --config and --stdin at the same time.' ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# if ( ( options . config_file or options . stdin_config ) and ( options . tag or args . watchfiles or options . host ) ) : #NEWLINE# #INDENT# main_logger . warning ( 'If --config or --stdin is set up options --tag, --watchfile, --type, --host and --port will be ignored.' ) #NEWLINE# #UNINDENT# if ( ( not ( options . config_file or options . stdin_config ) ) and ( not ( options . tag and options . watchfiles and options . host ) ) ) : #NEWLINE# #INDENT# parser . error ( 'Options --tag, --watchfile and --host must be set up at the same time.' ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# return ( options , args )