BrightSide Workbench Full Report + Source Code
WebLoggers.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2022 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.log;
20 
21 import org.turro.elephant.context.ElephantContext;
22 
27 public class WebLoggers {
28 
29  public WebLoggers exception(Throwable throwable) {
30  loggers.exception(throwable);
31  return this;
32  }
33 
34  public WebLoggers message(String text, Object... parameters) {
35  loggers.message(text, parameters);
36  return this;
37  }
38 
39  public void log() {
40  loggers.log();
41  }
42 
43  public static WebLoggers info(Object entity) {
44  return info(entity.getClass());
45  }
46 
47  public static WebLoggers warning(Object entity) {
48  return warning(entity.getClass());
49  }
50 
51  public static WebLoggers severe(Object entity) {
52  return severe(entity.getClass());
53  }
54 
55  public static WebLoggers info(Class type) {
56  return new WebLoggers(Loggers.info(type));
57  }
58 
59  public static WebLoggers warning(Class type) {
60  return new WebLoggers(Loggers.warning(type));
61  }
62 
63  public static WebLoggers severe(Class type) {
64  return new WebLoggers(Loggers.severe(type));
65  }
66 
67  private final Loggers loggers;
68 
69  public WebLoggers(Loggers loggers) {
70  this.loggers = loggers;
71  this.loggers.context(ElephantContext.getSiteName());
72  }
73 
74 }
static WebLoggers severe(Class type)
Definition: WebLoggers.java:63
static WebLoggers warning(Object entity)
Definition: WebLoggers.java:47
WebLoggers message(String text, Object... parameters)
Definition: WebLoggers.java:34
static WebLoggers severe(Object entity)
Definition: WebLoggers.java:51
static WebLoggers warning(Class type)
Definition: WebLoggers.java:59
WebLoggers exception(Throwable throwable)
Definition: WebLoggers.java:29
static WebLoggers info(Object entity)
Definition: WebLoggers.java:43
WebLoggers(Loggers loggers)
Definition: WebLoggers.java:69
static WebLoggers info(Class type)
Definition: WebLoggers.java:55