Écrire des journaux structurés dans Cloud Functions
bookmark_borderbookmark
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cet exemple montre comment écrire des journaux structurés dans Cloud Functions à l'aide du client de journalisation Google Cloud. Les journaux structurés offrent un moyen plus détaillé et organisé d'enregistrer des informations sur votre application, ce qui facilite l'analyse et la résolution des problèmes.
Exemple de code
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],[],[[["This sample demonstrates how to write structured logs in Cloud Functions using the Google Cloud logging client in both Node.js and Python."],["Structured logs offer a detailed and organized method for recording application information, aiding in issue troubleshooting and analysis."],["The code examples showcase initializing the logging client, creating log entries with metadata like severity and components, and writing them to the log."],["In both samples, setting up Application Default Credentials is required for authenticating to Cloud Run functions."],["The HTTP request data is attached automatically for request-log correlation."]]],[]]