From edc7cdb6f3db5734468fc8540fb1865888cb9555 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Wed, 21 Oct 2020 23:24:53 +0200 Subject: [PATCH] A few log message changes. --- src/client/lib.cr | 8 +++----- src/client/main.cr | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/client/lib.cr b/src/client/lib.cr index 9bff707..e99716d 100644 --- a/src/client/lib.cr +++ b/src/client/lib.cr @@ -85,7 +85,6 @@ class FileStorage::Client < IPC::Client def get_chunks(dl_response : FileStorage::Response::Download, path : String = ".") file_path = "#{path}/#{dl_response.file_info.name}" - Baguette::Log.debug "Getting #{file_path}" digest = dl_response.file_info.digest buffer_size = FileStorage.message_buffer_size @@ -94,12 +93,10 @@ class FileStorage::Client < IPC::Client size = 0 while counter < dl_response.file_info.nb_chunks - Baguette::Log.debug "Getting #{file_path}: chunk #{counter+1}/#{dl_response.file_info.nb_chunks}" + Baguette::Log.debug "getting #{file_path}: chunk #{counter+1}/#{dl_response.file_info.nb_chunks}" get_chunk_message = FileStorage::Request::GetChunk.new digest, counter send_now @server_fd.not_nil!, get_chunk_message response = parse_message [ FileStorage::Response::GetChunk ], read - # TODO: write the file - pp! response case response when FileStorage::Response::GetChunk @@ -120,7 +117,8 @@ class FileStorage::Client < IPC::Client data : Bytes ) - pp! file_path, chunk_size, offset, data.size + # pp! file_path, chunk_size, offset, data.size + Baguette::Log.debug "writing on #{file_path}" # Create the file if non existant. File.open(file_path, "a+") do |file| diff --git a/src/client/main.cr b/src/client/main.cr index 693a341..c0035be 100644 --- a/src/client/main.cr +++ b/src/client/main.cr @@ -126,8 +126,6 @@ def put(client : FileStorage::Client) end def get(client : FileStorage::Client) - Baguette::Log.warning "get command not complete, yet" - files = Context.args files.each do |filedigest| response = client.download filedigest @@ -136,7 +134,7 @@ def get(client : FileStorage::Client) Baguette::Log.info "downloading file #{filedigest} with #{response.file_info.nb_chunks} chunks" client.get_chunks response, Context.path else - Baguette::Log.error ">> #{response.class.name}" + Baguette::Log.error "#{response.class.name}" next end end