-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoggerFactory.cfc
34 lines (26 loc) · 1.28 KB
/
LoggerFactory.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
<cfcomponent displayname="LoggerFactory" output="false">
<cfscript>
instance = structNew();
</cfscript>
<cffunction name="init" access="public" output="false" hint="Singleton Logger Factory">
<cfargument name="levels" type="string" required="false" />
<cfscript>
setRepository( createObject( "component", "logging.Repository" ).init( argumentCollection = arguments ) );
return this;
</cfscript>
</cffunction>
<!------------------------------------------- PUBLIC ------------------------------------------->
<cffunction name="getLogger" returntype="logging.Logger" access="public" output="false">
<cfargument name="name" type="string" required="true"/>
<cfreturn getRepository().getLogger( arguments.name ) />
</cffunction>
<!------------------------------------------- PACKAGE ------------------------------------------->
<!------------------------------------------- PRIVATE ------------------------------------------->
<cffunction name="getRepository" access="private" output="false">
<cfreturn instance.repository />
</cffunction>
<cffunction name="setRepository" access="private" output="false">
<cfargument name="repository" type="logging.Repository" required="true" />
<cfset instance.repository = arguments.repository />
</cffunction>
</cfcomponent>