
    k
                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  \R                   " \R"                  R$                  \R"                  R&                  5       " S S\R(                  5      5       rg)zapp logs tail command.    )absolute_import)division)unicode_literals)	logs_util)base)flags)stream)log)
propertiesc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	Tail   z!Streams logs for App Engine apps.EXAMPLESa            To stream logs from a serving app, run:

            $ {command}

          To show only logs with a specific service, version, and level, run:

            $ {command} --service=s1 --version=v1 --level=warning

          To show only the logs from the request log for Standard apps, run:

            $ {command} --logs=request_log

          To show only the logs from the request log for Flex apps, run:

            $ {command} --logs=nginx.request
      c                     [         R                  R                  U 5        [         R                  R                  U 5        [         R                  R                  U 5        [         R
                  R                  U 5        g)z Register flags for this command.N)r   SERVICEAddToParserVERSIONLEVELLOGS)parsers    lib/surface/app/logs/tail.pyArgs	Tail.Args5   sL     
MMf%	MMf%	KKF#	JJ6"    c                    [         R                  " 5       nUR                  [         R                  5        UR                  [         R                  5        UR                  [         R
                  5        [        R                  R                  R                  R                  SS9n[         R                  " X1R                  UR                  UR                  UR                  5      n[         R"                  R%                  S5        [&        R(                  " USSS9nUR+                  5        H1  n[         R,                  R%                  UR/                  U5      5        M3     g )NT)requiredzWaiting for new log entries...   d   )filterspolling_intervalnum_prev_entries)r   
LogPrinterRegisterFormatterFormatRequestLogEntryFormatNginxLogEntryFormatAppEntryr   VALUEScoreprojectGet
GetFilterslogsserviceversionlevelr
   statusPrintr	   
LogFetcher	YieldLogsoutFormat)selfargsprinterr)   r   log_fetcher	log_entrys          r   RunTail.Run=   s    ""$Gi==>i;;<i667$$,,00$0?G""7IIt||#'<<=G JJ56##G5658:K !**,		ggmmGNN9-. -r    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r;   __static_attributes__r=   r   r   r   r      s/    )  
-( # #/r   r   N)rB   
__future__r   r   r   googlecloudsdk.api_lib.appr   googlecloudsdk.callioper   googlecloudsdk.command_lib.appr   googlecloudsdk.command_lib.logsr	   googlecloudsdk.corer
   r   ReleaseTracksReleaseTrackBETAGACommandr   r=   r   r   <module>rQ      sj     &  ' 0 ( 0 2 # * D%%**D,=,=,@,@A-/4<< -/ B-/r   