| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.message; |
| 7 |
|
| 8 |
/** |
| 9 |
* The backend of the trace system must implement this interface. Two |
| 10 |
* implementations are supported: the (default) native trace writer |
| 11 |
* implementation that can write to a file and to system out, and an adapter |
| 12 |
* that uses SLF4J (Simple Logging Facade for Java). |
| 13 |
*/ |
| 14 |
interface TraceWriter { |
| 15 |
|
| 16 |
/** |
| 17 |
* Set the name of the database or trace object. |
| 18 |
* |
| 19 |
* @param name the new name |
| 20 |
*/ |
| 21 |
void setName(String name); |
| 22 |
|
| 23 |
/** |
| 24 |
* Write a message. |
| 25 |
* |
| 26 |
* @param level the trace level |
| 27 |
* @param module the name of the module |
| 28 |
* @param s the message |
| 29 |
* @param t the exception (may be null) |
| 30 |
*/ |
| 31 |
void write(int level, String module, String s, Throwable t); |
| 32 |
|
| 33 |
/** |
| 34 |
* Write a message. |
| 35 |
* |
| 36 |
* @param level the trace level |
| 37 |
* @param moduleId the id of the module |
| 38 |
* @param s the message |
| 39 |
* @param t the exception (may be null) |
| 40 |
*/ |
| 41 |
void write(int level, int moduleId, String s, Throwable t); |
| 42 |
|
| 43 |
|
| 44 |
/** |
| 45 |
* Check the given trace / log level is enabled. |
| 46 |
* |
| 47 |
* @param level the level |
| 48 |
* @return true if the level is enabled |
| 49 |
*/ |
| 50 |
boolean isEnabled(int level); |
| 51 |
|
| 52 |
} |