Challenge: Secure Logging
Opgave
Swipe to start coding
Write a function that logs user actions without exposing sensitive information. Your function must ensure that no secrets or personal data are included in the logs.
- Remove any key-value pairs from the
detailsdictionary whose key matches'password','ssn','credit_card', or'secret'. - Create a log message that includes the
user_id,action, and the filtered details. - Log the message using the
loggingmodule. - Return the log message as a string.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 5
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Suggested prompts:
Can you explain that in simpler terms?
What are the main benefits of this approach?
Are there any common mistakes to avoid with this?
Awesome!
Completion rate improved to 5.56
Challenge: Secure Logging
Stryg for at vise menuen
Opgave
Swipe to start coding
Write a function that logs user actions without exposing sensitive information. Your function must ensure that no secrets or personal data are included in the logs.
- Remove any key-value pairs from the
detailsdictionary whose key matches'password','ssn','credit_card', or'secret'. - Create a log message that includes the
user_id,action, and the filtered details. - Log the message using the
loggingmodule. - Return the log message as a string.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 5
single