From 025b5d1dcbb30e727afee3307d49328432bae603 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Fri, 9 Apr 2021 08:09:20 -0400 Subject: Modified how logging works so that multiple processes can write in theory. --- captain/external.f90 | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'captain/external.f90') diff --git a/captain/external.f90 b/captain/external.f90 index 5cbee17..518abcb 100644 --- a/captain/external.f90 +++ b/captain/external.f90 @@ -119,7 +119,6 @@ contains integer::i_start_jobs, ierr character(len=:), pointer::linklist - character(64)::dbgstr n = get_jobs_count() if(n == 0) then @@ -147,9 +146,6 @@ contains res = "## Jobs " - write(dbgstr, '(I3,1X,I3)') i_start_jobs, min(i_start_jobs+14, n) - call write_log("Jobs between "//trim(dbgstr)) - linklist => render_jobs_links(jobs, i_start_jobs, min(i_start_jobs+14, n)) res = trim(res)//trim(linklist) call write_log(linklist) @@ -586,7 +582,7 @@ contains ext = " " end if - call write_log("Static check: "//trim(first)) + call write_log("Static check: "//trim(first), LOG_DEBUG) is_request_static = ((trim(first) == "releases") .or. & (trim(first) == "uploads") .or. & @@ -630,7 +626,7 @@ contains end function external_redirect_action_request_gemini function external_request_static(req) result(resp) - use logging, only: write_log + use logging use config use utilities use server_response @@ -653,7 +649,7 @@ contains inquire(file=resp%body_filename, exist=exists) if(.not. exists) then resp%code = GEMINI_CODE_PERMFAIL - call write_log("File did not exist: "//resp%body_filename) + call write_log("File did not exist: "//resp%body_filename, LOG_NORMAL) else resp%code = GEMINI_CODE_SUCCESS @@ -678,7 +674,7 @@ contains function external_request_templated(req) result(resp) use page_template use config, only: template_filepath, project - use logging, only: write_log + use logging use server_response implicit none @@ -694,15 +690,13 @@ contains call template_filepath("index.gmi", template_file) call page%init(trim(template_file)) - call write_log("Processing request") + call write_log("Processing request", LOG_INFO) call req%path_component(1, first) if(trim(req%location) == "/" .or. trim(req%location) == "/index.gmi") then - call write_log("Assign") call page%assign('title', 'Home') - call write_log("Assign done") else if(trim(req%location) == "/releases.gmi") then @@ -757,7 +751,7 @@ contains call write_log("Rendering page for "//req%location) call page%render() - call write_log("Finalizing response") + call write_log("Finalizing response", LOG_INFO) resp%temporary_file = .true. resp%body_filename => page%output_filename resp%body_mimetype = "text/gemini" @@ -774,23 +768,23 @@ contains type(response)::resp if(is_redirect_action(req)) then - call write_log("Action request") + call write_log("Action request", LOG_INFO) resp = external_redirect_action_request_gemini(req) else if(is_input_provided_request(req)) then - call write_log("Input request") + call write_log("Input request", LOG_INFO) resp = external_input_request_gemini(req) else if(is_input_required_request(req)) then - call write_log("Input required") + call write_log("Input required", LOG_INFO) resp = external_input_required_gemini(req) else if(is_request_static(req)) then - call write_log("Req static") + call write_log("Req static", LOG_INFO) resp = external_request_static(req) else - call write_log("Req template") + call write_log("Req template", LOG_INFO) resp = external_request_templated(req) end if -- cgit v1.2.3