Python2 programming model

Sample code:

import logging
logger = logging.getLogger()
logging.basicConfig(level=logging.INFO)

def main(event):
    print "test function log by print"
    logger.info("test function log by logger")
    return "OK"

Event parameter: In Python2 runtime environment, the entry function must be main(event). Cloud Functions will use this parameter to transmit data to the running function. This parameter can be either dict or NoneType in Python. Returned value: Function returned value is optional, depending on whether the function needs a returned value. Logging: Logs can be logged by print statement or logging module. These logs are written to the Splunk log service.

results matching ""

    No results matching ""