12a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32a97ec55SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42a97ec55SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52a97ec55SAndrew Rist  * distributed with this work for additional information
62a97ec55SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72a97ec55SAndrew Rist  * to you under the Apache License, Version 2.0 (the
82a97ec55SAndrew Rist  * "License"); you may not use this file except in compliance
92a97ec55SAndrew Rist  * with the License.  You may obtain a copy of the License at
102a97ec55SAndrew Rist  *
112a97ec55SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122a97ec55SAndrew Rist  *
132a97ec55SAndrew Rist  * Unless required by applicable law or agreed to in writing,
142a97ec55SAndrew Rist  * software distributed under the License is distributed on an
152a97ec55SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162a97ec55SAndrew Rist  * KIND, either express or implied.  See the License for the
172a97ec55SAndrew Rist  * specific language governing permissions and limitations
182a97ec55SAndrew Rist  * under the License.
192a97ec55SAndrew Rist  *
202a97ec55SAndrew Rist  *************************************************************/
212a97ec55SAndrew Rist 
222a97ec55SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "log_module.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <stdio.h>
30cdf0e10cSrcweir #include <string>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /** === begin UNO includes === **/
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LOGGING_XLOGFORMATTER_HPP_
34cdf0e10cSrcweir #include <com/sun/star/logging/XCsvLogFormatter.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LOGGING_XLOGFORMATTER_HPP_
37cdf0e10cSrcweir #include <com/sun/star/logging/XLogFormatter.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
40cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
43cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir /** === end UNO includes === **/
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #include <osl/thread.h>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace logging
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     /** === begin UNO using === **/
59cdf0e10cSrcweir     using ::com::sun::star::logging::XCsvLogFormatter;
60cdf0e10cSrcweir     using ::com::sun::star::logging::XLogFormatter;
61cdf0e10cSrcweir     using ::com::sun::star::uno::XComponentContext;
62cdf0e10cSrcweir     using ::com::sun::star::uno::Reference;
63cdf0e10cSrcweir     using ::com::sun::star::uno::Sequence;
64cdf0e10cSrcweir     using ::com::sun::star::lang::XServiceInfo;
65cdf0e10cSrcweir     using ::com::sun::star::uno::RuntimeException;
66cdf0e10cSrcweir     using ::com::sun::star::logging::LogRecord;
67cdf0e10cSrcweir     using ::com::sun::star::uno::XInterface;
68cdf0e10cSrcweir     /** === end UNO using === **/
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     //= CsvFormatter - declaration
71cdf0e10cSrcweir     //= formats for csv files as defined by RFC4180
72cdf0e10cSrcweir     typedef ::cppu::WeakImplHelper2 <   XCsvLogFormatter
73cdf0e10cSrcweir                                     ,   XServiceInfo
74cdf0e10cSrcweir                                     >   CsvFormatter_Base;
75cdf0e10cSrcweir     class CsvFormatter : public CsvFormatter_Base
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir     public:
78cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL formatMultiColumn(const Sequence< ::rtl::OUString>& column_data) throw (RuntimeException);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir         // XServiceInfo - static version
81cdf0e10cSrcweir         static ::rtl::OUString SAL_CALL getImplementationName_static();
82cdf0e10cSrcweir         static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
83cdf0e10cSrcweir         static Reference< XInterface > Create( const Reference< XComponentContext >& context );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     protected:
86cdf0e10cSrcweir         CsvFormatter( const Reference< XComponentContext >& context );
87cdf0e10cSrcweir         virtual ~CsvFormatter();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         // XCsvLogFormatter
90cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getLogEventNo() throw (RuntimeException);
91cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getLogThread() throw (RuntimeException);
92cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getLogTimestamp() throw (RuntimeException);
93cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getLogSource() throw (RuntimeException);
94cdf0e10cSrcweir         virtual Sequence< ::rtl::OUString > SAL_CALL getColumnnames() throw (RuntimeException);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         virtual void SAL_CALL setLogEventNo( ::sal_Bool log_event_no ) throw (RuntimeException);
97cdf0e10cSrcweir         virtual void SAL_CALL setLogThread( ::sal_Bool log_thread ) throw (RuntimeException);
98cdf0e10cSrcweir         virtual void SAL_CALL setLogTimestamp( ::sal_Bool log_timestamp ) throw (RuntimeException);
99cdf0e10cSrcweir         virtual void SAL_CALL setLogSource( ::sal_Bool log_source ) throw (RuntimeException);
100cdf0e10cSrcweir         virtual void SAL_CALL setColumnnames( const Sequence< ::rtl::OUString>& column_names) throw (RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         // XLogFormatter
103cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getHead(  ) throw (RuntimeException);
104cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL format( const LogRecord& Record ) throw (RuntimeException);
105cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getTail(  ) throw (RuntimeException);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         // XServiceInfo
108cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException);
109cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& service_name ) throw(RuntimeException);
110cdf0e10cSrcweir         virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     private:
113cdf0e10cSrcweir         ::comphelper::ComponentContext m_aContext;
114cdf0e10cSrcweir         ::sal_Bool m_LogEventNo;
115cdf0e10cSrcweir         ::sal_Bool m_LogThread;
116cdf0e10cSrcweir         ::sal_Bool m_LogTimestamp;
117cdf0e10cSrcweir         ::sal_Bool m_LogSource;
118cdf0e10cSrcweir         ::sal_Bool m_MultiColumn;
119cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::rtl::OUString > m_Columnnames;
120cdf0e10cSrcweir     };
121cdf0e10cSrcweir } // namespace logging
122cdf0e10cSrcweir 
123cdf0e10cSrcweir //= private helpers
124cdf0e10cSrcweir namespace
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     const sal_Unicode quote_char = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")).toChar();
127cdf0e10cSrcweir     const sal_Unicode comma_char = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")).toChar();
128cdf0e10cSrcweir     const ::rtl::OUString dos_newline = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\r\n"));
129cdf0e10cSrcweir 
needsQuoting(const::rtl::OUString & str)130cdf0e10cSrcweir     inline bool needsQuoting(const ::rtl::OUString& str)
131cdf0e10cSrcweir     {
132cdf0e10cSrcweir         static const ::rtl::OUString quote_trigger_chars = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("\",\n\r"));
133cdf0e10cSrcweir         sal_Int32 len = str.getLength();
134cdf0e10cSrcweir         for(sal_Int32 i=0; i<len; i++)
135cdf0e10cSrcweir             if(quote_trigger_chars.indexOf(str[i])!=-1)
136cdf0e10cSrcweir                 return true;
137cdf0e10cSrcweir         return false;
138cdf0e10cSrcweir     };
139cdf0e10cSrcweir 
appendEncodedString(::rtl::OUStringBuffer & buf,const::rtl::OUString & str)140cdf0e10cSrcweir     inline void appendEncodedString(::rtl::OUStringBuffer& buf, const ::rtl::OUString& str)
141cdf0e10cSrcweir     {
142cdf0e10cSrcweir         if(needsQuoting(str))
143cdf0e10cSrcweir         {
144cdf0e10cSrcweir             // each double-quote will get replaced by two double-quotes
145cdf0e10cSrcweir             buf.append(quote_char);
146cdf0e10cSrcweir             const sal_Int32 buf_offset = buf.getLength();
147cdf0e10cSrcweir             const sal_Int32 str_length = str.getLength();
148cdf0e10cSrcweir             buf.append(str);
149cdf0e10cSrcweir             // special treatment for the last character
150cdf0e10cSrcweir             if(quote_char==str[str_length-1])
151cdf0e10cSrcweir                 buf.append(quote_char);
152*30acf5e8Spfg             // iterating backwards because the index at which we insert won't be shifted
153cdf0e10cSrcweir             // when moving that way.
154cdf0e10cSrcweir             for(sal_Int32 i = str_length; i>=0; )
155cdf0e10cSrcweir             {
156cdf0e10cSrcweir                 i=str.lastIndexOf(quote_char, --i);
157cdf0e10cSrcweir                 if(i!=-1)
158cdf0e10cSrcweir                     buf.insert(buf_offset + i, quote_char);
159cdf0e10cSrcweir             }
160cdf0e10cSrcweir             buf.append(quote_char);
161cdf0e10cSrcweir         }
162cdf0e10cSrcweir         else
163cdf0e10cSrcweir             buf.append(str);
164cdf0e10cSrcweir     };
165cdf0e10cSrcweir 
initialColumns()166cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString> initialColumns()
167cdf0e10cSrcweir     {
168cdf0e10cSrcweir         com::sun::star::uno::Sequence< ::rtl::OUString> result = ::com::sun::star::uno::Sequence< ::rtl::OUString>(1);
169cdf0e10cSrcweir         result[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("message"));
170cdf0e10cSrcweir         return result;
171cdf0e10cSrcweir     };
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir //= CsvFormatter - implementation
175cdf0e10cSrcweir namespace logging
176cdf0e10cSrcweir {
CsvFormatter(const Reference<XComponentContext> & context)177cdf0e10cSrcweir     CsvFormatter::CsvFormatter( const Reference< XComponentContext >& context )
178cdf0e10cSrcweir         :m_aContext( context ),
179cdf0e10cSrcweir         m_LogEventNo(true),
180cdf0e10cSrcweir         m_LogThread(true),
181cdf0e10cSrcweir         m_LogTimestamp(true),
182cdf0e10cSrcweir         m_LogSource(false),
183cdf0e10cSrcweir         m_MultiColumn(false),
184cdf0e10cSrcweir         m_Columnnames(initialColumns())
185cdf0e10cSrcweir     { }
186cdf0e10cSrcweir 
~CsvFormatter()187cdf0e10cSrcweir     CsvFormatter::~CsvFormatter()
188cdf0e10cSrcweir     { }
189cdf0e10cSrcweir 
getLogEventNo()190cdf0e10cSrcweir     ::sal_Bool CsvFormatter::getLogEventNo() throw (RuntimeException)
191cdf0e10cSrcweir     {
192cdf0e10cSrcweir         return m_LogEventNo;
193cdf0e10cSrcweir     }
194cdf0e10cSrcweir 
getLogThread()195cdf0e10cSrcweir     ::sal_Bool CsvFormatter::getLogThread() throw (RuntimeException)
196cdf0e10cSrcweir     {
197cdf0e10cSrcweir         return m_LogThread;
198cdf0e10cSrcweir     }
199cdf0e10cSrcweir 
getLogTimestamp()200cdf0e10cSrcweir     ::sal_Bool CsvFormatter::getLogTimestamp() throw (RuntimeException)
201cdf0e10cSrcweir     {
202cdf0e10cSrcweir         return m_LogTimestamp;
203cdf0e10cSrcweir     }
204cdf0e10cSrcweir 
getLogSource()205cdf0e10cSrcweir     ::sal_Bool CsvFormatter::getLogSource() throw (RuntimeException)
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         return m_LogSource;
208cdf0e10cSrcweir     }
209cdf0e10cSrcweir 
getColumnnames()210cdf0e10cSrcweir     Sequence< ::rtl::OUString > CsvFormatter::getColumnnames() throw (RuntimeException)
211cdf0e10cSrcweir     {
212cdf0e10cSrcweir         return m_Columnnames;
213cdf0e10cSrcweir     }
214cdf0e10cSrcweir 
setLogEventNo(::sal_Bool log_event_no)215cdf0e10cSrcweir     void CsvFormatter::setLogEventNo(::sal_Bool log_event_no) throw (RuntimeException)
216cdf0e10cSrcweir     {
217cdf0e10cSrcweir         m_LogEventNo = log_event_no;
218cdf0e10cSrcweir     }
219cdf0e10cSrcweir 
setLogThread(::sal_Bool log_thread)220cdf0e10cSrcweir     void CsvFormatter::setLogThread(::sal_Bool log_thread) throw (RuntimeException)
221cdf0e10cSrcweir     {
222cdf0e10cSrcweir         m_LogThread = log_thread;
223cdf0e10cSrcweir     }
224cdf0e10cSrcweir 
setLogTimestamp(::sal_Bool log_timestamp)225cdf0e10cSrcweir     void CsvFormatter::setLogTimestamp(::sal_Bool log_timestamp) throw (RuntimeException)
226cdf0e10cSrcweir     {
227cdf0e10cSrcweir         m_LogTimestamp = log_timestamp;
228cdf0e10cSrcweir     }
229cdf0e10cSrcweir 
setLogSource(::sal_Bool log_source)230cdf0e10cSrcweir     void CsvFormatter::setLogSource(::sal_Bool log_source) throw (RuntimeException)
231cdf0e10cSrcweir     {
232cdf0e10cSrcweir         m_LogSource = log_source;
233cdf0e10cSrcweir     }
234cdf0e10cSrcweir 
setColumnnames(const Sequence<::rtl::OUString> & columnnames)235cdf0e10cSrcweir     void CsvFormatter::setColumnnames(const Sequence< ::rtl::OUString >& columnnames) throw (RuntimeException)
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         m_Columnnames = Sequence< ::rtl::OUString>(columnnames);
238cdf0e10cSrcweir         m_MultiColumn = (m_Columnnames.getLength()>1);
239cdf0e10cSrcweir     }
240cdf0e10cSrcweir 
getHead()241cdf0e10cSrcweir     ::rtl::OUString SAL_CALL CsvFormatter::getHead(  ) throw (RuntimeException)
242cdf0e10cSrcweir     {
243cdf0e10cSrcweir         ::rtl::OUStringBuffer buf;
244cdf0e10cSrcweir         if(m_LogEventNo)
245cdf0e10cSrcweir             buf.appendAscii("event no,");
246cdf0e10cSrcweir         if(m_LogThread)
247cdf0e10cSrcweir             buf.appendAscii("thread,");
248cdf0e10cSrcweir         if(m_LogTimestamp)
249cdf0e10cSrcweir             buf.appendAscii("timestamp,");
250cdf0e10cSrcweir         if(m_LogSource)
251cdf0e10cSrcweir             buf.appendAscii("class,method,");
252cdf0e10cSrcweir         sal_Int32 columns = m_Columnnames.getLength();
253cdf0e10cSrcweir         for(sal_Int32 i=0; i<columns; i++)
254cdf0e10cSrcweir         {
255cdf0e10cSrcweir             buf.append(m_Columnnames[i]);
256cdf0e10cSrcweir             buf.append(comma_char);
257cdf0e10cSrcweir         }
258cdf0e10cSrcweir         buf.setLength(buf.getLength()-1);
259cdf0e10cSrcweir         buf.append(dos_newline);
260cdf0e10cSrcweir         return buf.makeStringAndClear();
261cdf0e10cSrcweir     }
262cdf0e10cSrcweir 
format(const LogRecord & record)263cdf0e10cSrcweir     ::rtl::OUString SAL_CALL CsvFormatter::format( const LogRecord& record ) throw (RuntimeException)
264cdf0e10cSrcweir     {
265cdf0e10cSrcweir         ::rtl::OUStringBuffer aLogEntry;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         if(m_LogEventNo)
268cdf0e10cSrcweir         {
269cdf0e10cSrcweir             aLogEntry.append( record.SequenceNumber );
270cdf0e10cSrcweir             aLogEntry.append(comma_char);
271cdf0e10cSrcweir         }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir         if(m_LogThread)
274cdf0e10cSrcweir         {
275cdf0e10cSrcweir             aLogEntry.append( record.ThreadID );
276cdf0e10cSrcweir             aLogEntry.append(comma_char);
277cdf0e10cSrcweir         }
278cdf0e10cSrcweir 
279cdf0e10cSrcweir         if(m_LogTimestamp)
280cdf0e10cSrcweir         {
281cdf0e10cSrcweir             // ISO 8601
282cdf0e10cSrcweir             char buffer[ 30 ];
283cdf0e10cSrcweir             const size_t buffer_size = sizeof( buffer );
284cdf0e10cSrcweir             snprintf( buffer, buffer_size, "%04i-%02i-%02iT%02i:%02i:%02i.%02i",
285cdf0e10cSrcweir                 (int)record.LogTime.Year,
286cdf0e10cSrcweir                 (int)record.LogTime.Month,
287cdf0e10cSrcweir                 (int)record.LogTime.Day,
288cdf0e10cSrcweir                 (int)record.LogTime.Hours,
289cdf0e10cSrcweir                 (int)record.LogTime.Minutes,
290cdf0e10cSrcweir                 (int)record.LogTime.Seconds,
291cdf0e10cSrcweir                 (int)record.LogTime.HundredthSeconds );
292cdf0e10cSrcweir             aLogEntry.appendAscii( buffer );
293cdf0e10cSrcweir             aLogEntry.append(comma_char);
294cdf0e10cSrcweir         }
295cdf0e10cSrcweir 
296cdf0e10cSrcweir         if(m_LogSource)
297cdf0e10cSrcweir         {
298cdf0e10cSrcweir             appendEncodedString(aLogEntry, record.SourceClassName);
299cdf0e10cSrcweir             aLogEntry.append(comma_char);
300cdf0e10cSrcweir 
301cdf0e10cSrcweir             appendEncodedString(aLogEntry, record.SourceMethodName);
302cdf0e10cSrcweir             aLogEntry.append(comma_char);
303cdf0e10cSrcweir         }
304cdf0e10cSrcweir 
305cdf0e10cSrcweir         // if the CsvFormatter has multiple columns set via setColumnnames(), the
306cdf0e10cSrcweir         // message of the record is expected to be encoded with formatMultiColumn
307cdf0e10cSrcweir         // if the CsvFormatter has only one column set, the message is expected not
308cdf0e10cSrcweir         // to be encoded
309cdf0e10cSrcweir         if(m_MultiColumn)
310cdf0e10cSrcweir             aLogEntry.append(record.Message);
311cdf0e10cSrcweir         else
312cdf0e10cSrcweir             appendEncodedString(aLogEntry, record.Message);
313cdf0e10cSrcweir 
314cdf0e10cSrcweir         aLogEntry.append( dos_newline );
315cdf0e10cSrcweir         return aLogEntry.makeStringAndClear();
316cdf0e10cSrcweir     }
317cdf0e10cSrcweir 
getTail()318cdf0e10cSrcweir     ::rtl::OUString SAL_CALL CsvFormatter::getTail(  ) throw (RuntimeException)
319cdf0e10cSrcweir     {
320cdf0e10cSrcweir         return ::rtl::OUString();
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir 
formatMultiColumn(const Sequence<::rtl::OUString> & column_data)323cdf0e10cSrcweir     ::rtl::OUString SAL_CALL CsvFormatter::formatMultiColumn(const Sequence< ::rtl::OUString>& column_data) throw (RuntimeException)
324cdf0e10cSrcweir     {
325cdf0e10cSrcweir         sal_Int32 columns = column_data.getLength();
326cdf0e10cSrcweir         ::rtl::OUStringBuffer buf;
327cdf0e10cSrcweir         for(int i=0; i<columns; i++)
328cdf0e10cSrcweir         {
329cdf0e10cSrcweir             appendEncodedString(buf, column_data[i]);
330cdf0e10cSrcweir             buf.append(comma_char);
331cdf0e10cSrcweir         }
332cdf0e10cSrcweir         buf.setLength(buf.getLength()-1);
333cdf0e10cSrcweir         return buf.makeStringAndClear();
334cdf0e10cSrcweir     }
335cdf0e10cSrcweir 
supportsService(const::rtl::OUString & service_name)336cdf0e10cSrcweir     ::sal_Bool SAL_CALL CsvFormatter::supportsService( const ::rtl::OUString& service_name ) throw(RuntimeException)
337cdf0e10cSrcweir     {
338cdf0e10cSrcweir         const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
339cdf0e10cSrcweir         for (   const ::rtl::OUString* pServiceNames = aServiceNames.getConstArray();
340cdf0e10cSrcweir                 pServiceNames != aServiceNames.getConstArray() + aServiceNames.getLength();
341cdf0e10cSrcweir                 ++pServiceNames
342cdf0e10cSrcweir             )
343cdf0e10cSrcweir             if ( service_name == *pServiceNames )
344cdf0e10cSrcweir                 return sal_True;
345cdf0e10cSrcweir         return sal_False;
346cdf0e10cSrcweir     }
347cdf0e10cSrcweir 
getImplementationName()348cdf0e10cSrcweir     ::rtl::OUString SAL_CALL CsvFormatter::getImplementationName() throw(RuntimeException)
349cdf0e10cSrcweir     {
350cdf0e10cSrcweir         return getImplementationName_static();
351cdf0e10cSrcweir     }
352cdf0e10cSrcweir 
getSupportedServiceNames()353cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL CsvFormatter::getSupportedServiceNames() throw(RuntimeException)
354cdf0e10cSrcweir     {
355cdf0e10cSrcweir         return getSupportedServiceNames_static();
356cdf0e10cSrcweir     }
357cdf0e10cSrcweir 
getImplementationName_static()358cdf0e10cSrcweir     ::rtl::OUString SAL_CALL CsvFormatter::getImplementationName_static()
359cdf0e10cSrcweir     {
360cdf0e10cSrcweir         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.CsvFormatter" ) );
361cdf0e10cSrcweir     }
362cdf0e10cSrcweir 
getSupportedServiceNames_static()363cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL CsvFormatter::getSupportedServiceNames_static()
364cdf0e10cSrcweir     {
365cdf0e10cSrcweir         Sequence< ::rtl::OUString > aServiceNames(1);
366cdf0e10cSrcweir         aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.CsvFormatter" ) );
367cdf0e10cSrcweir         return aServiceNames;
368cdf0e10cSrcweir     }
369cdf0e10cSrcweir 
Create(const Reference<XComponentContext> & context)370cdf0e10cSrcweir     Reference< XInterface > CsvFormatter::Create( const Reference< XComponentContext >& context )
371cdf0e10cSrcweir     {
372cdf0e10cSrcweir         return *( new CsvFormatter( context ) );
373cdf0e10cSrcweir     }
374cdf0e10cSrcweir 
createRegistryInfo_CsvFormatter()375cdf0e10cSrcweir     void createRegistryInfo_CsvFormatter()
376cdf0e10cSrcweir     {
377cdf0e10cSrcweir         static OAutoRegistration< CsvFormatter > aAutoRegistration;
378cdf0e10cSrcweir     }
379cdf0e10cSrcweir } // namespace logging
380