LibreOffice Module extensions (master) 1
loghandler.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
26#include <com/sun/star/logging/XLogFormatter.hpp>
27#include <com/sun/star/uno/XComponentContext.hpp>
28#include <com/sun/star/logging/LogRecord.hpp>
29
32#include <rtl/string.hxx>
33
34
35namespace logging
36{
37
39 {
40 private:
41 // <attributes>
42 rtl_TextEncoding m_eEncoding;
43 sal_Int32 m_nLevel;
44 css::uno::Reference< css::logging::XLogFormatter >
46 // <//attributes>
47
48 css::uno::Reference< css::uno::XComponentContext >
50 ::osl::Mutex& m_rMutex;
53
54 public:
56 const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
57 ::osl::Mutex& _rMutex,
59 );
60
61 public:
63
64 bool getEncoding( OUString& _out_rEncoding ) const;
65 bool setEncoding( std::u16string_view _rEncoding );
66
67 rtl_TextEncoding
68 getTextEncoding() const { return m_eEncoding; }
69
70 const css::uno::Reference< css::logging::XLogFormatter >&
71 getFormatter() const { return m_xFormatter; }
72 void
73 setFormatter( const css::uno::Reference< css::logging::XLogFormatter >& _rxFormatter )
74 {
75 m_xFormatter = _rxFormatter;
76 }
77
78 sal_Int32
79 getLevel() const { return m_nLevel; }
80 void
81 setLevel( const sal_Int32 _nLevel )
82 {
83 m_nLevel = _nLevel;
84 }
85
95 void enterMethod();
96
109 bool formatForPublishing( const css::logging::LogRecord& _rRecord, OString& _out_rEntry ) const;
110
115 bool getEncodedHead( OString& _out_rHead ) const;
116
121 bool getEncodedTail( OString& _out_rTail ) const;
122
135 void initFromSettings( const ::comphelper::NamedValueCollection& _rSettings );
136 };
137
138
139} // namespace logging
140
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LogHandlerHelper(const css::uno::Reference< css::uno::XComponentContext > &_rxContext, ::osl::Mutex &_rMutex, ::cppu::OBroadcastHelper &_rBHelper)
Definition: loghandler.cxx:47
void setLevel(const sal_Int32 _nLevel)
Definition: loghandler.hxx:81
bool getEncoding(OUString &_out_rEncoding) const
Definition: loghandler.cxx:98
void enterMethod()
prepares implementation of a public accessible method of a log handler
Definition: loghandler.cxx:72
const css::uno::Reference< css::logging::XLogFormatter > & getFormatter() const
Definition: loghandler.hxx:71
::cppu::OBroadcastHelper & m_rBHelper
Definition: loghandler.hxx:51
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: loghandler.hxx:49
bool setEncoding(std::u16string_view _rEncoding)
Definition: loghandler.cxx:111
void initFromSettings(const ::comphelper::NamedValueCollection &_rSettings)
initializes the instance from a collection of named settings
Definition: loghandler.cxx:58
sal_Int32 getLevel() const
Definition: loghandler.hxx:79
void setFormatter(const css::uno::Reference< css::logging::XLogFormatter > &_rxFormatter)
Definition: loghandler.hxx:73
bool formatForPublishing(const css::logging::LogRecord &_rRecord, OString &_out_rEntry) const
formats a record for publishing it
Definition: loghandler.cxx:124
rtl_TextEncoding getTextEncoding() const
Definition: loghandler.hxx:68
css::uno::Reference< css::logging::XLogFormatter > m_xFormatter
Definition: loghandler.hxx:45
bool getEncodedTail(OString &_out_rTail) const
retrieves our formatter's tail, encoded with our encoding
Definition: loghandler.cxx:162
bool getEncodedHead(OString &_out_rHead) const
retrieves our formatter's heading, encoded with our encoding
Definition: loghandler.cxx:145
::osl::Mutex & m_rMutex
Definition: loghandler.hxx:50
rtl_TextEncoding m_eEncoding
Definition: loghandler.hxx:42