Free as in Freedom: Codeberg.org. Create your repos!
Browse Source

Tune down the INFO logging, use debug log level where sensible

Libraries should usually stay silent if everything works as
expected. Most of the INFO log levels call sites of pgpainless
actually are more of debug log level call sites. Hence this commit
changes most of them to use a debug log level.
master
Florian Schmaus 1 month ago
parent
commit
8abea678ca

+ 3
- 3
pgpainless-core/src/main/java/org/pgpainless/decryption_verification/DecryptionStreamFactory.java View File

@@ -216,16 +216,16 @@ public final class DecryptionStreamFactory {
216 216
             }
217 217
 
218 218
             if (verificationKey == null) {
219
-                LOGGER.log(Level.INFO, "No public key for signature of " + Long.toHexString(keyId) + " found.");
219
+                LOGGER.log(Level.FINER, "No public key for signature of " + Long.toHexString(keyId) + " found.");
220 220
 
221 221
                 if (missingPublicKeyCallback == null) {
222
-                    LOGGER.log(Level.INFO, "Skip signature of " + Long.toHexString(keyId));
222
+                    LOGGER.log(Level.FINER, "Skip signature of " + Long.toHexString(keyId));
223 223
                     continue;
224 224
                 }
225 225
 
226 226
                 PGPPublicKey missingPublicKey = missingPublicKeyCallback.onMissingPublicKeyEncountered(keyId);
227 227
                 if (missingPublicKey == null) {
228
-                    LOGGER.log(Level.INFO, "Skip signature of " + Long.toHexString(keyId));
228
+                    LOGGER.log(Level.FINER, "Skip signature of " + Long.toHexString(keyId));
229 229
                     continue;
230 230
                 }
231 231
 

+ 2
- 2
pgpainless-core/src/main/java/org/pgpainless/util/KeyRingSubKeyFix.java View File

@@ -73,7 +73,7 @@ public class KeyRingSubKeyFix {
73 73
                 PGPSecretKey secSubKey = secretKeyIterator.next();
74 74
 
75 75
                 if (secSubKey.isMasterKey()) {
76
-                    LOGGER.log(Level.INFO, Long.toHexString(secSubKey.getKeyID()) + " is master key. Skip.");
76
+                    LOGGER.log(Level.FINER, Long.toHexString(secSubKey.getKeyID()) + " is master key. Skip.");
77 77
                     _secretKeys.add(secSubKey);
78 78
                     continue;
79 79
                 }
@@ -93,7 +93,7 @@ public class KeyRingSubKeyFix {
93 93
                 }
94 94
 
95 95
                 // Sub key is normal key -> fix
96
-                LOGGER.log(Level.INFO, "Subkey " + Long.toHexString(secSubKey.getKeyID()) + " does not have a subkey key packet. Convert it...");
96
+                LOGGER.log(Level.FINER, "Subkey " + Long.toHexString(secSubKey.getKeyID()) + " does not have a subkey key packet. Convert it...");
97 97
                 keyPacket = new PublicSubkeyPacket(pubSubKey.getAlgorithm(), pubSubKey.getCreationTime(), keyPacket.getKey());
98 98
                 publicPk.set(pubSubKey, keyPacket);
99 99
 

+ 8
- 8
pgpainless-core/src/test/java/org/pgpainless/BCUtilTest.java View File

@@ -57,22 +57,22 @@ public class BCUtilTest extends AbstractPGPainlessTest {
57 57
         PGPSecretKeyRing sec = ring.getSecretKeys();
58 58
         PGPPublicKeyRing pub = ring.getPublicKeys();
59 59
 
60
-        LOGGER.log(Level.INFO, "Main ID: " + sec.getPublicKey().getKeyID() + " " + pub.getPublicKey().getKeyID());
60
+        LOGGER.log(Level.FINER, "Main ID: " + sec.getPublicKey().getKeyID() + " " + pub.getPublicKey().getKeyID());
61 61
 
62 62
         int secSize = 1;
63 63
         Iterator<PGPPublicKey> secPubIt = sec.getPublicKeys();
64 64
         while (secPubIt.hasNext()) {
65 65
             PGPPublicKey k = secPubIt.next();
66
-            LOGGER.log(Level.INFO, secSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey());
66
+            LOGGER.log(Level.FINER, secSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey());
67 67
             secSize++;
68 68
         }
69 69
 
70
-        LOGGER.log(Level.INFO, "After BCUtil.publicKeyRingFromSecretKeyRing()");
70
+        LOGGER.log(Level.FINER, "After BCUtil.publicKeyRingFromSecretKeyRing()");
71 71
         int pubSize = 1;
72 72
         Iterator<PGPPublicKey> pubPubIt = pub.getPublicKeys();
73 73
         while (pubPubIt.hasNext()) {
74 74
             PGPPublicKey k = pubPubIt.next();
75
-            LOGGER.log(Level.INFO, pubSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey());
75
+            LOGGER.log(Level.FINER, pubSize + " " + k.getKeyID() + " " + k.isEncryptionKey() + " " + k.isMasterKey());
76 76
             pubSize++;
77 77
         }
78 78
 
@@ -84,11 +84,11 @@ public class BCUtilTest extends AbstractPGPainlessTest {
84 84
         Iterator<PGPSecretKeyRing> secColIt = secCol.getKeyRings();
85 85
         while (secColIt.hasNext()) {
86 86
             PGPSecretKeyRing r = secColIt.next();
87
-            LOGGER.log(Level.INFO, "" + r.getPublicKey().getKeyID());
87
+            LOGGER.log(Level.FINER, "" + r.getPublicKey().getKeyID());
88 88
             secColSize++;
89 89
         }
90 90
 
91
-        LOGGER.log(Level.INFO, "SecCol: " + secColSize);
91
+        LOGGER.log(Level.FINER, "SecCol: " + secColSize);
92 92
 
93 93
         PGPPublicKeyRingCollection pubCol = BCUtil.keyRingsToKeyRingCollection(pub);
94 94
 
@@ -96,11 +96,11 @@ public class BCUtilTest extends AbstractPGPainlessTest {
96 96
         Iterator<PGPPublicKeyRing> pubColIt = pubCol.getKeyRings();
97 97
         while (pubColIt.hasNext()) {
98 98
             PGPPublicKeyRing r = pubColIt.next();
99
-            LOGGER.log(Level.INFO, "" + r.getPublicKey().getKeyID());
99
+            LOGGER.log(Level.FINER, "" + r.getPublicKey().getKeyID());
100 100
             pubColSize++;
101 101
         }
102 102
 
103
-        LOGGER.log(Level.INFO, "PubCol: " + pubColSize);
103
+        LOGGER.log(Level.FINER, "PubCol: " + pubColSize);
104 104
     }
105 105
 
106 106
     @Test

+ 6
- 6
pgpainless-core/src/test/java/org/pgpainless/LengthTest.java View File

@@ -47,7 +47,7 @@ public class LengthTest extends AbstractPGPainlessTest {
47 47
     public void ecEc()
48 48
             throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
49 49
             IOException {
50
-        LOGGER.log(Level.INFO, "\nEC -> EC");
50
+        LOGGER.log(Level.FINER, "\nEC -> EC");
51 51
         PGPKeyRing sender = PGPainless.generateKeyRing().simpleEcKeyRing("simplejid@server.tld");
52 52
         PGPKeyRing recipient = PGPainless.generateKeyRing().simpleEcKeyRing("otherjid@other.srv");
53 53
         encryptDecryptForSecretKeyRings(sender, recipient);
@@ -58,7 +58,7 @@ public class LengthTest extends AbstractPGPainlessTest {
58 58
     public void RsaRsa()
59 59
             throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
60 60
             IOException {
61
-        LOGGER.log(Level.INFO, "\nRSA-2048 -> RSA-2048");
61
+        LOGGER.log(Level.FINER, "\nRSA-2048 -> RSA-2048");
62 62
         @SuppressWarnings("deprecation")
63 63
         PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._2048);
64 64
         @SuppressWarnings("deprecation")
@@ -70,7 +70,7 @@ public class LengthTest extends AbstractPGPainlessTest {
70 70
     public void RsaRsa4096()
71 71
             throws PGPException,
72 72
             IOException {
73
-        LOGGER.log(Level.INFO, "\nRSA-4096 -> RSA-4096");
73
+        LOGGER.log(Level.FINER, "\nRSA-4096 -> RSA-4096");
74 74
         PGPKeyRing sender = PGPainless.readKeyRing().keyRing(TestKeys.JULIET_PUB, TestKeys.JULIET_SEC);
75 75
         PGPKeyRing recipient = PGPainless.readKeyRing().keyRing(TestKeys.ROMEO_PUB, TestKeys.ROMEO_SEC);
76 76
         encryptDecryptForSecretKeyRings(sender, recipient);
@@ -79,7 +79,7 @@ public class LengthTest extends AbstractPGPainlessTest {
79 79
     // @Test
80 80
     public void rsaEc() throws PGPException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException,
81 81
             NoSuchProviderException {
82
-        LOGGER.log(Level.INFO, "\nRSA-2048 -> EC");
82
+        LOGGER.log(Level.FINER, "\nRSA-2048 -> EC");
83 83
         @SuppressWarnings("deprecation")
84 84
         PGPKeyRing sender = PGPainless.generateKeyRing().simpleRsaKeyRing("simplejid@server.tld", RsaLength._2048);
85 85
         PGPKeyRing recipient = PGPainless.generateKeyRing().simpleEcKeyRing("otherjid@other.srv");
@@ -90,7 +90,7 @@ public class LengthTest extends AbstractPGPainlessTest {
90 90
     public void ecRsa()
91 91
             throws PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException,
92 92
             IOException {
93
-        LOGGER.log(Level.INFO, "\nEC -> RSA-2048");
93
+        LOGGER.log(Level.FINER, "\nEC -> RSA-2048");
94 94
         PGPKeyRing sender = PGPainless.generateKeyRing().simpleEcKeyRing("simplejid@server.tld");
95 95
         @SuppressWarnings("deprecation")
96 96
         PGPKeyRing recipient = PGPainless.generateKeyRing().simpleRsaKeyRing("otherjid@other.srv", RsaLength._2048);
@@ -126,7 +126,7 @@ public class LengthTest extends AbstractPGPainlessTest {
126 126
             encryptor.close();
127 127
             byte[] encryptedSecretMessage = envelope.toByteArray();
128 128
 
129
-            LOGGER.log(Level.INFO,"\n" + encryptedSecretMessage.length);
129
+            LOGGER.log(Level.FINER,"\n" + encryptedSecretMessage.length);
130 130
         }
131 131
     }
132 132
 }

Loading…
Cancel
Save