Complete the code to enable basic logging in Supabase.
const supabase = createClient(supabaseUrl, supabaseKey, { [1]: 'info' });The logLevel option sets the logging level in Supabase client configuration.
Complete the code to fetch logs from Supabase's built-in logging system.
const logs = await supabase.[1]('function_logs').select('*');
The from method is used to select a table or view in Supabase to query data, including logs.
Fix the error in the code to subscribe to real-time logs.
supabase.[1]('logs').on('INSERT', payload => console.log(payload)).subscribe();
The from method is used to specify the table or channel to listen to real-time changes in Supabase.
Fill both blanks to create a filter for error logs with severity greater than 3.
const errorLogs = await supabase.from('logs').select('*').[1]('severity', [2], 3);
The gt filter means 'greater than'. We use it to get logs where severity is greater than 3.
Fill all three blanks to create a dictionary of logs with keys as uppercase log levels and values as messages for logs with status 'active'.
const activeLogs = Object.fromEntries( (await supabase.from('logs').select('level, message').eq('status', [1])).data .map(log => [log.[2](), log.[3]]) );
We filter logs where status equals 'active'. Then map each log to a key-value pair where the key is the uppercase level and the value is the message.