简体   繁体   中英

LOGGER IN r, msg function in R

I am a beginner in R, While I have to edit some pre written codes in R. there is a specific one which I cannot understand. it would be really helpful if anyone can help me understand this.

# Logger
log.msg = function(msg){
  ## capture messages and errors to a file.
  fileConn<-file("output.txt", open = "a+")
  writeLines(c(msg), fileConn)
  close(fileConn)
}

 log.msg("Start Data extraction and merging..")
log.msg = function(msg){
  ## capture messages and errors to a file.

  ## create file connection in append mode (a+)
  fileConn<-file("output.txt", open = "a+")

  ## write the msg to this file
  writeLines(c(msg), fileConn)

  ## close connection
  close(fileConn)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM