規則。偵錯
命名空間靜態
偵錯
偵錯()
基本偵錯功能,在安全規則引擎評估安全規則語言物件、變數和語句結果時列印它們。 debug
的輸出寫入 firestore-debug.log。
debug
函數只能在規則條件內呼叫。
debug
功能塊僅由 Firestore 模擬器(Firebase 模擬器套件的一部分)中的安全規則引擎執行。調試功能對生產沒有影響。
在偵錯日誌檔案條目前面新增了一個字串,該字串標識日誌輸出的規則語言資料類型(例如string_value
、 map_value
)。
對debug
呼叫可以嵌套。
目前, debug
功能不支援日誌記錄等級的概念(例如,INFO、WARN、ERROR)。
// firestore.rules // Nested debug calls in the following match block.... match /carts/{cartID} { allow create: if request.auth != null && request.auth.uid == request.resource.data.ownerUID; allow read, update, delete: if debug( debug(request.auth.uid) == debug(resource.data.ownerUID) ); } ... // firestore-debug.log // ...produce logfile output like the following. string_value: "alice" // for debug(request.auth.uid) string_value: "alice" // for debug(resource.data.ownerUID) bool_value: true // for the outermost enclosing debug() call ...