ataggart said: The only valid levels are the ones specified in the documentation, those levels in common use across multiple logging implementations. If one uses an invalid value one should not expect it to work.

The "correct" solution would be to provide a better exception in this error case.

Assembla Importer
added a comment - 24/Aug/10 2:35 PM ataggart said: The only valid levels are the ones specified in the documentation, those levels in common use across multiple logging implementations. If one uses an invalid value one should not expect it to work.
The "correct" solution would be to provide a better exception in this error case.

rnewman said: "If one uses an invalid value one should not expect it to work"

No, but one should expect something more useful than a NPE. The patch I attached throws an exception when an invalid value is used (indeed, at compile time if it's a constant keyword).

c.c.l already translates from one set of log levels to those in use by the underlying implementation (e.g., if you're using Java Logging it'll convert :debug to FINE). This patch ensures that you can use the other set of names, too, which seems perfectly reasonable, but I can understand if you disagree. In that case, simply change translate-log-level to something like

Assembla Importer
added a comment - 24/Aug/10 2:35 PM rnewman said: "If one uses an invalid value one should not expect it to work"
No, but one should expect something more useful than a NPE. The patch I attached throws an exception when an invalid value is used (indeed, at compile time if it's a constant keyword).
c.c.l already translates from one set of log levels to those in use by the underlying implementation (e.g., if you're using Java Logging it'll convert :debug to FINE). This patch ensures that you can use the other set of names, too, which seems perfectly reasonable, but I can understand if you disagree. In that case, simply change translate-log-level to something like
(defn translate-log-level [level]
(or (#{:trace :debug :info :warn :error :fatal} level)
(throw (new Exception (str "Unknown log level " (prn-str level))))))
and commit. I'm not particularly fussed either way, but the validation needs to be done.

Assembla Importer
added a comment - 24/Aug/10 2:35 PM ataggart said: Handled at the protocol implementation level in new version of c.c.logging (since alternate implementations may choose to use non-standard levels).