|
@@ -30,7 +30,7 @@ To print comments like a pro, you use the following logger syntax.
|
|
|
+
|
|
+
|
|
|
[source,java]
|
|
[source,java]
|
|
|
----
|
|
----
|
|
|
-private static final Logger logger = Logger.getLogger(HelloWorld.class.getName());
|
|
|
|
|
|
|
+private static final Logger LOGGER = Logger.getLogger(HelloWorld.class.getName());
|
|
|
----
|
|
----
|
|
|
|
|
|
|
|
. Declare the info that you want to include in the message. The variables (here `a, b, c`) can be any printable Java object. +
|
|
. Declare the info that you want to include in the message. The variables (here `a, b, c`) can be any printable Java object. +
|
|
@@ -41,7 +41,7 @@ Example: `Vector3f a = cam.getLocation();`
|
|
|
+
|
|
+
|
|
|
[source,java]
|
|
[source,java]
|
|
|
----
|
|
----
|
|
|
-logger.log(Level.WARNING, "why is {0} set to {1} again?!",
|
|
|
|
|
|
|
+LOGGER.log(Level.WARNING, "why is {0} set to {1} again?!",
|
|
|
new Object[]{a , b});
|
|
new Object[]{a , b});
|
|
|
----
|
|
----
|
|
|
|
|
|
|
@@ -49,13 +49,10 @@ logger.log(Level.WARNING, "why is {0} set to {1} again?!",
|
|
|
+
|
|
+
|
|
|
[source,java]
|
|
[source,java]
|
|
|
----
|
|
----
|
|
|
-logger.log(Level.SEVERE, "MyGame error: {0} must not be {1} after {2}! Adjust flux generator settings.",
|
|
|
|
|
|
|
+LOGGER.log(Level.SEVERE, "MyGame error: {0} must not be {1} after {2}! Adjust flux generator settings.",
|
|
|
new Object[]{a , b , c});
|
|
new Object[]{a , b , c});
|
|
|
----
|
|
----
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
[IMPORTANT]
|
|
[IMPORTANT]
|
|
|
====
|
|
====
|
|
|
As you see in the examples, you should phrase potentially “customer facing errors in a neutral way and offer _a reason and a solution_ for the error (if you don't, it has no value to your customer). If your deveopment team uses WARNINGs as replacement for casual printlns, make sure you deactivate them for the release.
|
|
As you see in the examples, you should phrase potentially “customer facing errors in a neutral way and offer _a reason and a solution_ for the error (if you don't, it has no value to your customer). If your deveopment team uses WARNINGs as replacement for casual printlns, make sure you deactivate them for the release.
|