-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogEvent.cfc
53 lines (42 loc) · 1.69 KB
/
LogEvent.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<cfcomponent name="LogEvent" output="false">
<cfscript>
instance = structNew();
</cfscript>
<cffunction name="init" access="public" output="false">
<cfargument name="logger" type="logging.Logger" required="true"/>
<cfargument name="level" type="string" required="true" />
<cfargument name="message" type="string" required="true" />
<cfargument name="error" required="false" />
<cfscript>
instance.logger = arguments.logger;
instance.level = arguments.level;
instance.message = arguments.message;
if( structKeyExists( arguments, 'error' ) and isObject( arguments.error ) ) {
instance.error = arguments.error;
}
instance.timestamp = now();
return this;
</cfscript>
</cffunction>
<!------------------------------------------- PUBLIC ------------------------------------------->
<cffunction name="getLogger" output="false" access="public">
<cfreturn instance.logger />
</cffunction>
<cffunction name="getLevel" output="false" access="public">
<cfreturn instance.level />
</cffunction>
<cffunction name="getMessage" output="false" access="public">
<cfreturn instance.message />
</cffunction>
<cffunction name="getTimestamp" output="false" access="public">
<cfreturn instance.timestamp />
</cffunction>
<cffunction name="getError" output="false" access="public">
<cfreturn instance.error />
</cffunction>
<cffunction name="hasError" output="false" access="public">
<cfreturn structKeyExists( instance, 'error' ) />
</cffunction>
<!------------------------------------------- PACKAGE ------------------------------------------->
<!------------------------------------------- PRIVATE ------------------------------------------->
</cfcomponent>