def create_sink(sink_name, destination_bucket, filter_):
 logging_client = logging.Client()
 destination = 'storage.googleapis.com/{bucket}'.format(bucket=destination_bucket)
 sink = logging_client.sink(sink_name, filter_, destination)
 if sink.exists():
  print 'Sink {} already exists.'.format(sink.name)
  return
 sink.create()
 print 'Created sink {}'.format(sink.name)

def create_sink ( sink_name , destination_bucket , filter_ ) : logging_client = logging . Client ( ) destination = 'storage.googleapis.com/{bucket}' . format ( bucket = destination_bucket ) sink = logging_client . sink ( sink_name , filter_ , destination ) if sink . exists ( ) : print 'Sink {} already exists.' . format ( sink . name ) return sink . create ( ) print 'Created sink {}' . format ( sink . name )
return a new sink with a numeric id incremented in a threadsafe way .