Skip to content

Instantly share code, notes, and snippets.

@sudogem
Last active March 25, 2024 08:18
Show Gist options
  • Save sudogem/4f57e286fb38c94dbe26bfcdfbcea453 to your computer and use it in GitHub Desktop.
Save sudogem/4f57e286fb38c94dbe26bfcdfbcea453 to your computer and use it in GitHub Desktop.
Create custom log file
#
# Create a file my_log.rb in app/models
# Copy & paste the code below in my_log.rb
class MyLog
class << self
def debug(msg)
File.open("log/logs.txt", "a+") {
|file|
file.write(msg)
file.write("\n")
}
end
end
end
# Example usage:
MyLog.debug("result data here")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment