bramp / bramp/ffmpeg-cli-wrapper
Allow user to replace all uses of STDOUT/STDERR for logging
- Ngôn ngữ chính
- Java
- Star
- 1.9k
- Fork
- 424
- Merge trung bình
- 5 giờ 35 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
Hello,
I deploy this library in an environment where the java processes stdout and stderr is discarded and there is no way for the developer
maintainer to see it.
I would like the ffmpeg errors to be captured without involving stderr as they are usefull to diagnose some errors.
To capture the errors you would need to either log them into java.util.logging or the slf4j logging facade.
I understand that you may not wish to include slf4j as a dependency.
I know that some people hate java.util.logging (and would prefer not to have to use it)
So my suggestion would be to have a global static variable that the user can set that determines where log lines get pumped to.
The default implementation would pump to stdout/stderr just like it currently does but I could then in my bootstrap of my application call
"FFmpegCommon.setLoggingSystem(FFmpegLoggingManager instance)" (just an example)
If I were to design this interface then I would give it only 1 method that looks like this:
void appendLog(Process ffmpegProc, boolean isStdErr, byte[] data, int off, int len);
If you do not want to hand in the process then please pass some unique identifier (aka process pid for example or a random UUID instead so I can tell appart error messages from multiple concurrent ffmpeg jobs)
I would outsource line breaks and all that thing to concrete implementations.
Currently I have to hack very deep into your library using inheritance to be able to accomplish this.
The default implementation that dumps everything to stdout/stderr could probably be as simple as this:
```java
public void appendLog(Process ffmpegProc, boolean isStdErr, byte[] data, int off, int len) {
PrintStream stream = isStdErr ? System.err : System.out;
try {
stream.write(data, off, len);
} catch(Exception e) {
//IGNORED
}
}
```
Sincerely
Alexander Schütz
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách xác định các đường dẫn mã ghi đầu ra của tiến trình FFmpeg vào System.out và System.err, bao gồm các hook kế thừa hiện đang cần thiết cho việc tùy chỉnh. Sử dụng FFmpegCommon.setLoggingSystem và giao diện appendLog làm điểm bắt đầu cho thiết kế; công việc được xem là hoàn tất khi các bên gọi có thể chuyển hướng cả hai stream trong khi hành vi mặc định vẫn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- cli, tooling
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100