+++ /dev/null
-<manifest>
- <define>
- <domain name="dlogutil"/>
- <provide>
- <label name="dlogutil::dlogutil"/>
- <label name="dlogutil::dlogctrl"/>
- <label name="dlogutil::dlog"/>
- </provide>
- </define>
- <request>
- <domain name="dlogutil"/>
- </request>
- <assign>
- <filesystem path="/usr/bin/dlogutil" label="dlogutil::dlogutil"/>
- <filesystem path="/usr/bin/dlogctrl" label="dlogutil::dlogctrl"/>
- <filesystem path="/opt/etc/dlog" label="dlogutil::dlog"/>
- <filesystem path="/etc/rc.d/init.d/dlog.sh" label="_" exec_label="none"/>
- <filesystem path="/etc/rc.d/rc3.d/S05dlog" label="_" exec_label="none"/>
- </assign>
-</manifest>
// ---------------------------------------------------------------------
/**
+ * Secure Log Macro.
+ */
+
+#define _SECURE_LOG 1
+
+#ifndef SECLOG
+#if _SECURE_LOG
+#define SECLOG(...) (0)
+#else
+#define SECLOG(format, arg...) \
+ (LOG_ON() ? (SLOG(LOG_WARN, LOG_TAG, "%s: %s(%d) > " format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
+#endif
+#endif
+
+// ---------------------------------------------------------------------
+/**
* Simplified macro to send a verbose log message using the current LOG_TAG.
*/
#ifndef LOGV
#define ALOGE(...) (ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
#endif
+
// ---------------------------------------------------------------------
/**
* Basic log message macro that allows you to specify a priority and a tag
}
static int __write_to_log_sd_journal_print(log_id_t log_id, log_priority prio, const char *tag, const char *msg)
{
- return sd_journal_print(dlog_pri_to_journal_pri(prio), "%c %s: %s",dlog_pri_to_char(prio), tag, msg);
+ return sd_journal_print(dlog_pri_to_journal_pri(prio), "%c %s: %s", dlog_pri_to_char(prio), tag, msg);
}
#endif
void init_dlog_level(void)
g_out_byte_count += bytes_written;
- if (g_log_rotate_size_kbytes > 0 && (g_out_byte_count / 1024) >= g_log_rotate_size_kbytes)
- {
- rotate_logs();
+ if (g_log_rotate_size_kbytes > 0 && (g_out_byte_count / 1024) >= g_log_rotate_size_kbytes) {
+ if (g_nonblock) {
+ exit(0);
+ } else {
+ rotate_logs();
+ }
}
error:
Name: dlog
Summary: Logging service
Version: 0.4.1
-Release: 4
+Release: 5
Group: System/Libraries
License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
Source101: dlog-main.service
Source102: dlog-radio.service
-Source103: tizen-debug-level.service
+Source103: packaging/dlogutil.manifest
+Source104: packaging/libdlog.manifest
+Source105: tizen-debug-level.service
+
BuildRequires: pkgconfig(libsystemd-journal)
Requires(post): /usr/bin/vconftool
Requires(post): coreutils
%install
rm -rf %{buildroot}
+cp %{SOURCE103} .
+cp %{SOURCE104} .
%make_install
-mkdir -p %{buildroot}/opt/etc/
-cp %{_builddir}/%{name}-%{version}/.dloglevel %{buildroot}/opt/etc/.dloglevel
+mkdir -p %{buildroot}/opt/etc/dlog
+cp %{_builddir}/%{name}-%{version}/.dloglevel %{buildroot}/opt/etc/dlog/.dloglevel
mkdir -p %{buildroot}/etc/profile.d/
cp %{_builddir}/%{name}-%{version}/tizen_platform_env.sh %{buildroot}/etc/profile.d/tizen_platform_env.sh
mkdir -p %{buildroot}/usr/bin/
install -m 0644 %SOURCE101 %{buildroot}%{_libdir}/systemd/system/
install -m 0644 %SOURCE102 %{buildroot}%{_libdir}/systemd/system/
-install -m 0644 %SOURCE103 %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %SOURCE105 %{buildroot}%{_libdir}/systemd/system/
ln -s ../dlog-main.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/dlog-main.service
ln -s ../dlog-radio.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/dlog-radio.service
%files -n dlogutil
%manifest dlogutil.manifest
-%{_bindir}/dlogutil
-%attr(775,root,root) %{_bindir}/dlogctrl
+/usr/share/license/%{name}
+%doc LICENSE.APLv2
+%attr(755,root,root) /opt/etc/dlog/.dloglevel
+%attr(755,root,root) /etc/profile.d/tizen_platform_env.sh
+%attr(755,root,app_logging) %{_bindir}/dlogutil
+%attr(755,root,app_logging) %{_bindir}/dlogctrl
%{_sysconfdir}/rc.d/init.d/dlog.sh
%{_sysconfdir}/rc.d/rc3.d/S05dlog
%{_libdir}/systemd/system/tizen-debug-level.service
%{_libdir}/systemd/system/basic.target.wants/tizen-debug-level.service
%{_libdir}/systemd/system/multi-user.target.wants/dlog-main.service
%{_libdir}/systemd/system/multi-user.target.wants/dlog-radio.service
-%attr(775,root,app) %dir /opt/etc/dlog
+%attr(775,root,app_logging) %dir /opt/etc/dlog
%files -n libdlog
-/usr/share/license/%{name}
-%doc LICENSE.APLv2
-/opt/etc/.dloglevel
-/etc/profile.d/tizen_platform_env.sh
+%manifest libdlog.manifest
%{_libdir}/libdlog.so.0
%{_libdir}/libdlog.so.0.0.0
--- /dev/null
+<manifest>
+ <define>
+ <domain name="dlogutil"/>
+ </define>
+ <assign>
+ <filesystem path="/usr/bin/dlogutil" label="_" exec_label="none"/>
+ <filesystem path="/usr/bin/dlogctrl" label="_" exec_label="none"/>
+ <filesystem path="/etc/rc.d/init.d/dlog.sh" label="_" exec_label="none"/>
+ <filesystem path="/etc/rc.d/rc3.d/S05dlog" label="_" exec_label="none"/>
+ <filesystem path="/usr/lib/systemd/system/basic.target.wants/tizen-debug-level.service" label="_" exec_label="none" />
+ <filesystem path="/usr/lib/systemd/system/dlog-main.service" label="_" exec_label="none" />
+ <filesystem path="/usr/lib/systemd/system/dlog-radio.service" label="_" exec_label="none" />
+ <filesystem path="/usr/lib/systemd/system/multi-user.target.wants/dlog-main.service" label="_" exec_label="none" />
+ <filesystem path="/usr/lib/systemd/system/multi-user.target.wants/dlog-radio.service" label="_" exec_label="none" />
+ <filesystem path="/usr/lib/systemd/system/tizen-debug-level.service" label="_" exec_label="none" />
+ </assign>
+ <request>
+ <domain name="dlogutil"/>
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <assign>
+ <filesystem path="/usr/lib/libdlog.so.0" label="_" exec_label="none"/>
+ <filesystem path="/usr/lib/libdlog.so.0.0" label="_" exec_label="none"/>
+ </assign>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
[Service]
Type=oneshot
-ExecStart=/bin/sh -c '/usr/bin/systemctl set-environment TIZEN_PLATFORMLOGGING_MODE=1 TIZEN_DLOG_LEVEL=$(cat /opt/etc/.dloglevel)'
+ExecStart=/bin/sh -c '/usr/bin/systemctl set-environment TIZEN_PLATFORMLOGGING_MODE=1 TIZEN_DLOG_LEVEL=$(cat /opt/etc/dlog/.dloglevel)'
[Install]
WantedBy=basic.target
# I'm not clear why "-a" doesn't work here
if [ "x$TIZEN_PLATFORMLOGGING_MODE" != "x" ] &&
[ "$TIZEN_PLATFORMLOGGING_MODE" -eq "1" ]; then
- dlevel=$(cat /opt/etc/.dloglevel)
+ dlevel=$(cat /opt/etc/dlog/.dloglevel)
if [ "$dlevel" -eq "0" ]; then
export TIZEN_DLOG_LEVEL=0
elif [ "$dlevel" -eq "1" ]; then