public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Lamprecht <t.lamprecht@proxmox.com>
Subject: [pve-devel] [PATCH http-server v2 1/5] add debug print helper
Date: Fri,  4 Dec 2020 18:56:25 +0100	[thread overview]
Message-ID: <20201204175629.30116-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20201204175629.30116-1-s.ivanov@proxmox.com>

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 PVE/APIServer/AnyEvent.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm
index c55da7f..7916bdd 100644
--- a/PVE/APIServer/AnyEvent.pm
+++ b/PVE/APIServer/AnyEvent.pm
@@ -66,6 +66,16 @@ my $split_abs_uri = sub {
     return wantarray ? ($rel_uri, $format) : $rel_uri;
 };
 
+sub dprint {
+    my ($self, $message) = @_;
+
+    return if !$self->{debug};
+
+    my ($pkg, $pkgfile, $line, $sub) = caller(1);
+    $sub =~ s/^.+::([^:]+)$/\1/;
+    print "worker[$$]: $pkg +$line: $sub: $message\n";
+}
+
 sub log_request {
     my ($self, $reqstate) = @_;
 
-- 
2.20.1





  reply	other threads:[~2020-12-04 17:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 17:56 [pve-devel] [PATCH http-server v2 0/5] improve error handling in accept_connections Stoiko Ivanov
2020-12-04 17:56 ` Stoiko Ivanov [this message]
2020-12-07 10:11   ` [pve-devel] [PATCH http-server v2 1/5] add debug print helper Thomas Lamprecht
2020-12-04 17:56 ` [pve-devel] [PATCH http-server v2 2/5] accept-phase: fix conn_count "leak" Stoiko Ivanov
2020-12-07 10:28   ` Thomas Lamprecht
2020-12-04 17:56 ` [pve-devel] [PATCH http-server v2 3/5] accept-phase: shutdown socket on early error Stoiko Ivanov
2020-12-07 10:39   ` Thomas Lamprecht
2020-12-04 17:56 ` [pve-devel] [PATCH http-server v2 4/5] add debug log for problems during accept Stoiko Ivanov
2020-12-07 10:50   ` Thomas Lamprecht
2020-12-04 17:56 ` [pve-devel] [PATCH http-server v2 5/5] debug: uniformly use dprint Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201204175629.30116-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal