0
0
Supabasecloud~10 mins

Monitoring and logging in Supabase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable basic logging in Supabase.

Supabase
const supabase = createClient(supabaseUrl, supabaseKey, { [1]: 'info' });
Drag options to blanks, or click blank then click option'
AlogLevel
Blogging
CdebugMode
Dlog
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'logging' instead of 'logLevel' causes the client to ignore the setting.
Using 'debugMode' is not a valid option in Supabase client.
2fill in blank
medium

Complete the code to fetch logs from Supabase's built-in logging system.

Supabase
const logs = await supabase.[1]('function_logs').select('*');
Drag options to blanks, or click blank then click option'
Afrom
BgetLogs
Ctable
Dlog
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'getLogs' is not a valid Supabase client method.
Using 'log' or 'table' does not correctly specify the table to query.
3fill in blank
hard

Fix the error in the code to subscribe to real-time logs.

Supabase
supabase.[1]('logs').on('INSERT', payload => console.log(payload)).subscribe();
Drag options to blanks, or click blank then click option'
Alisten
Bsubscribe
Cchannel
Dfrom
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'subscribe' directly without specifying the source causes an error.
Using 'listen' or 'channel' are not valid Supabase client methods.
4fill in blank
hard

Fill both blanks to create a filter for error logs with severity greater than 3.

Supabase
const errorLogs = await supabase.from('logs').select('*').[1]('severity', [2], 3);
Drag options to blanks, or click blank then click option'
Agt
Beq
Clt
Dneq
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'eq' or 'lt' will not filter logs with severity greater than 3.
Using different values for method and operator causes errors.
5fill in blank
hard

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'.

Supabase
const activeLogs = Object.fromEntries(
  (await supabase.from('logs').select('level, message').eq('status', [1])).data
    .map(log => [log.[2](), log.[3]])
);
Drag options to blanks, or click blank then click option'
A'active'
Blevel.toUpperCase
Cmessage
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using status without quotes causes a syntax error.
Using 'level' without calling toUpperCase() results in lowercase keys.
Using wrong property names for message causes undefined values.