-
-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Closed
Copy link
Description
Description
The copi.owasp.org/lib/copi_web/live/player_live/show.ex file contains several IO.puts debug statements that should be replaced with proper Logger calls.
Issue
In production Elixir applications, IO.puts is not appropriate for logging because:
- It writes directly to stdout without any log level context
- Output is not captured by structured logging systems (e.g., Logger backends)
- Can't be filtered or controlled via log level configuration
- No metadata (timestamp, module, function) is included
- Not suitable for production monitoring and debugging
Location
File: copi.owasp.org/lib/copi_web/live/player_live/show.ex
The following debug statements need to be replaced:
Line 112:
IO.puts("Continue vote added successfully")Line 114:
IO.puts("Continue voting failed")Line 135:
IO.puts("player has voted")Line 138:
IO.puts("player hasn't voted")Line 141:
IO.puts("voted successfully")Line 143:
IO.puts("voting failed")Proposed Solution
Replace all IO.puts statements with appropriate Logger calls:
- Success messages →
Logger.debug/1(since these are routine operations) - Error messages →
Logger.warning/1orLogger.error/1(for failed operations)
Example replacements:
# Before
IO.puts("Continue vote added successfully")
# After
Logger.debug("Continue vote added successfully for player_id: #{player.id}, game_id: #{game.id}")# Before
IO.puts("Continue voting failed")
# After
Logger.warning("Continue voting failed for player_id: #{player.id}, game_id: #{game.id}")Additional Context
This appears to be leftover debug code from development. The rest of the codebase properly uses Logger (e.g., in rate_limiter.ex and user_socket.ex), so this should be updated for consistency.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels