Redirect the “puts” command output to a log file

后端 未结 4 1242
小蘑菇
小蘑菇 2021-01-31 10:49

I am working on creating a daemon in Ruby using the daemons gem. I want to add output from the daemon into a log file. I am wondering what is the easiest way to redirect p

4条回答
  •  不要未来只要你来
    2021-01-31 11:28

    Or you can redefine the puts command? Works probably only in a single file/class

    def puts(message)
       #write message to file
    end
    

提交回复
热议问题