You can use the following codes in function to record logs at different levels:
<Timestamp> <Request ID> <Log Level> <Message>
For example, when you run the following code:
The log output is:
2016-08-18T05:38:41.401Z 1234567890 verbose hello world
If you have set a Log Service logstore for the service of the function, the “hello world” log from the preceding example is collected to the configured logstore.
By using command line tool fcli, you can conveniently view the logs at service or function level. Try the following commands in fcli shell mode:
- To view logs of a service dimension, run
- To view logs of a function dimension, run
- You can also view the logs generated during a certain period. Run
logs --helpfor more information.
For more information about how to enable service/function log by using fcli, see relevant documentation.