feat: Add logging to script

This commit is contained in:
Thomas A. Christensen II 2024-09-04 15:21:32 -05:00
parent b5200c5a8a
commit cc3d2908ed
Signed by: millironx
GPG key ID: B7044A3432851F64
2 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View file

@ -33,3 +33,4 @@ docs/site/
data.tsv data.tsv
Q*.docx Q*.docx
Q*.md Q*.md
*.log

10
main.jl
View file

@ -1,6 +1,13 @@
#!/usr/bin/env julia #!/usr/bin/env julia
using CSV using CSV
using DataFrames using DataFrames
using Dates
using Logging
# Set logging to file
log_io = open("antimicrobial-use-survey-analysis_$(now()).log", "w+")
logger = SimpleLogger(log_io)
global_logger(logger)
# Import data # Import data
survey_data = DataFrame(CSV.File("data.tsv"; delim='\t', normalizenames=true)) survey_data = DataFrame(CSV.File("data.tsv"; delim='\t', normalizenames=true))
@ -33,3 +40,6 @@ for q in questions
run(`pandoc $q.md -o $q.docx`) run(`pandoc $q.md -o $q.docx`)
end #for end #for
# Close log file
close(log_io)