Exemple #1
0
 def _run_registry():
   global _APP_INITIALIZED
   if _APP_INITIALIZED:
     raise AppException("Attempted to initialize application more than once!")
   # initialize options.
   options.parse()
   environment = options.values().twitter_common_app_environment
   for runlevel in sorted(_APP_REGISTRY.keys()):
     for fn, env, description in _APP_REGISTRY[runlevel]:
       if env is None or environment == env:
         if options.values().twitter_common_app_debug and description:
           print >> sys.stderr, \
             "twitter.common.app runlevel %s, running initializer: %s" % (
               runlevel, description)
         fn()
   _APP_INITIALIZED = True
Exemple #2
0
 def stdout_log_scheme():
   """
     Get the current stdout log scheme.
   """
   if LogOptions._STDOUT_LOG_SCHEME is None:
     LogOptions.set_stdout_log_level(options.values().twitter_common_log_stdout_log_level)
   return LogOptions._STDOUT_LOG_SCHEME
Exemple #3
0
 def log_dir():
   """
     Get the current directory into which logs will be written.
   """
   if LogOptions._LOG_DIR is None:
     LogOptions._LOG_DIR = options.values().twitter_common_log_log_dir
   return LogOptions._LOG_DIR
Exemple #4
0
 def stdout_log_level():
   """
     Get the current stdout_log_level (in logging units specified by logging module.)
   """
   if LogOptions._STDOUT_LOG_LEVEL is None:
     LogOptions.set_stdout_log_level(options.values().twitter_common_log_stdout_log_level)
   return LogOptions._STDOUT_LOG_LEVEL
Exemple #5
0
 def disk_log_scheme():
   """
     Get the current disk log scheme.
   """
   if LogOptions._DISK_LOG_SCHEME is None:
     LogOptions.set_disk_log_level(options.values().twitter_common_log_stdout_log_level)
   return LogOptions._DISK_LOG_SCHEME
Exemple #6
0
 def disk_log_level():
   """
     Get the current disk_log_level (in logging units specified by logging module.)
   """
   if LogOptions._DISK_LOG_LEVEL is None:
     LogOptions.set_disk_log_level(options.values().twitter_common_log_disk_log_level)
   return LogOptions._DISK_LOG_LEVEL
Exemple #7
0
 def disk_log_level():
   """
     Get the current disk_log_level (in logging units specified by logging module.)
   """
   if LogOptions._DISK_LOG_LEVEL is None:
     LogOptions.set_stdout_log_level(options.values().glog_log_to_disk)
   return LogOptions._DISK_LOG_LEVEL
Exemple #8
0
 def _run_registry():
     global _APP_INITIALIZED
     if _APP_INITIALIZED:
         raise AppException(
             "Attempted to initialize application more than once!")
     # initialize options.
     options.parse()
     environment = options.values().twitter_common_app_environment
     for runlevel in sorted(_APP_REGISTRY.keys()):
         for fn, env, description in _APP_REGISTRY[runlevel]:
             if env is None or environment == env:
                 if options.values(
                 ).twitter_common_app_debug and description:
                     print >> sys.stderr, \
                       "twitter.common.app runlevel %s, running initializer: %s" % (
                         runlevel, description)
                 fn()
     _APP_INITIALIZED = True
Exemple #9
0
 def _environment():
   if not _APP_INITIALIZED:
     raise AppException("Cannot get environment until twitter.common.app has been initialized!")
   return options.values().twitter_common_app_environment
Exemple #10
0
 def _environment():
     if not _APP_INITIALIZED:
         raise AppException(
             "Cannot get environment until twitter.common.app has been initialized!"
         )
     return options.values().twitter_common_app_environment