Skip to content

Commit

Permalink
Make ffmpeg logging configurable with env var
Browse files Browse the repository at this point in the history
  • Loading branch information
codez committed Apr 19, 2024
1 parent 289c8b6 commit 2e57ea6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/services/audio_processor/ffmpeg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module AudioProcessor

FFMPEG.logger = Rails.env.development? ? Rails.logger : Logger.new('/dev/null')
log = Rails.env.development? || ENV['FFMPEG_LOG'].present?
FFMPEG.logger = log ? Rails.logger : Logger.new('/dev/null')

# Specific processor class working with FFmpeg backend.
class Ffmpeg < Base
Expand Down Expand Up @@ -131,7 +132,7 @@ def number_of_seconds(segments)
end

def run_command(*command)
FFMPEG.logger.info("Running command...\n#{command.join(' ')}\n")
FFMPEG.logger.info("Running command...\n#{command.inspect}\n")
out, status = Open3.capture2e(*command)
unless status.success?
raise(FFMPEG::Error,
Expand Down
1 change: 1 addition & 0 deletions doc/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ An easy way to manage these values is to create a `~/.env` file with several `VA
| RAAR_DB_PASSWORD | The password used to connect to the database. | - |
| RAAR_DB_ADAPTER | The database adapter name, e.g. `postgresql`. | sqlite3 |
| RAAR_LOG | Where to log messages. Either 'syslog', 'stdout' or empty to use the rails defaults (`log/production.log`). | - |
| FFMPEG_LOG | If set to true, log ffmpeg commands as well. | - |
| AIRTIME_DB_NAME | The airtime database name to connect to. | - |
| AIRTIME_DB_HOST | The airtime database host to connect to. | - |
| AIRTIME_DB_PORT | The airtime database port to connect to. | - |
Expand Down

0 comments on commit 2e57ea6

Please sign in to comment.