Name |
Ceylon Logging Platform Module |
---|---|
Category |
SDK
The Ceylon SDK |
Backends | JVM JavaScript |
Maven coordinates | |
Compatible Ceylon release |
JVM: 1.1.0 (outdated) JavaScript: 1.1.0 (outdated) |
Published | Oct 8, 2014 |
Stats |
Downloads (JVM): 775 Downloads (JS): 229 Source downloads: 795 |
Description |
Defines a platform-neutral API for writing log messages.
This module does not actually define any infrastructure
for log message output, so the program must register a
addLogWriter { void log(Priority p, Category c, String m, Exception? e) { value print = p<=info then process.writeLine else process.writeError; print("[``system.milliseconds``] ``p.string`` ``m``"); if (exists e) { printStackTrace(e, print); } } }; Log messages are written to a Logger log = logger(`module hello`); The methods log.debug("trying to do something"); try { doSomething(); } catch (e) { log.error("something bad happened", e); } For log messages with interpolated expressions, these methods accept an anonymous function. log.debug(()=>"trying to do ``something``"); try { do(something); } catch (e) { log.error(()=>"badness happened doing ``something``", e); } By default, only log messages with priority at least
defaultPriority = debug; Alternatively, we can assign an explicit priority to a
specific logger(`module hello`).priority = debug; For integration with other logging libraries, it is
possible to completely replace the logger = (Category category) => JDKLoggerImpl(JDKLogger.getLogger(category.qualifiedName)); |
Dependencies | |
Usage |
import ceylon.logging "1.1.0"; |
Module links |
Members Imported By Home Code repository Issue tracker Browse Download .car Download .js Download source archive Download module documentation View API documentation |