Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/tizen_log/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Omit obvious local variable types.
* Reformat with a line length of 100.
* Use wrapper API.

## 0.1.3

Expand Down
12 changes: 5 additions & 7 deletions packages/tizen_log/lib/tizen_log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'dart:ffi';

import 'package:ffi/ffi.dart';

typedef _DlogPrintNative = Void Function(Int32, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef _DlogPrint = void Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef _DlogPrintNative = Int Function(Int, Pointer<Utf8>, Pointer<Utf8>);
typedef _DlogPrint = int Function(int, Pointer<Utf8>, Pointer<Utf8>);

/// Provides the ability to use Tizen's logging service, dlog.
///
Expand All @@ -20,10 +20,10 @@ typedef _DlogPrint = void Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Ut
class Log {
Log._();

static final DynamicLibrary _library = DynamicLibrary.open('libdlog.so.0');
static final DynamicLibrary _library = DynamicLibrary.open('libftpw_tizen_log.so');

static final _DlogPrint _dlogPrint =
_library.lookup<NativeFunction<_DlogPrintNative>>('dlog_print').asFunction();
_library.lookup<NativeFunction<_DlogPrintNative>>('ftpw_tizen_log_dlog_print').asFunction();

static final RegExp _stackTraceRegExp = RegExp(
r'^#(\d+)\s+(.+)\((.+\.dart):(\d+)(:\d+)?\)$',
Expand Down Expand Up @@ -166,11 +166,9 @@ class Log {
message = '${file ?? "-"}: ${func ?? "-"}(${line ?? "-"}) > $message';
}
final Pointer<Utf8> tagPtr = tag.toNativeUtf8();
final Pointer<Utf8> formatPtr = '%s'.toNativeUtf8();
final Pointer<Utf8> messagePtr = message.toNativeUtf8();
_dlogPrint(priority.value, tagPtr, formatPtr, messagePtr);
_dlogPrint(priority.value, tagPtr, messagePtr);
malloc.free(tagPtr);
malloc.free(formatPtr);
malloc.free(messagePtr);
}

Expand Down
7 changes: 7 additions & 0 deletions packages/tizen_log/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ environment:

dependencies:
ffi: ">=1.1.2 <3.0.0"

flutter:
plugin:
platforms:
tizen:
pluginClass: TizenLogPlugin
fileName: tizen_log_plugin.h
5 changes: 5 additions & 0 deletions packages/tizen_log/tizen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.cproject
.sign
crash-info/
Debug/
Release/
17 changes: 17 additions & 0 deletions packages/tizen_log/tizen/inc/ftpw_tizen_log.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_TIZEN_PLUGINS_WRAPPER_TIZEN_LOG_H_
#define FLUTTER_TIZEN_PLUGINS_WRAPPER_TIZEN_LOG_H_

#ifdef __cplusplus
extern "C" {
#endif

int ftpw_tizen_log_dlog_print(int priority, const char *tag, const char *message);

#ifdef __cplusplus
}
#endif

#endif
27 changes: 27 additions & 0 deletions packages/tizen_log/tizen/inc/tizen_log_plugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_PLUGIN_TIZEN_LOG_PLUGIN_H_
#define FLUTTER_PLUGIN_TIZEN_LOG_PLUGIN_H_

#include <flutter_plugin_registrar.h>

#ifdef FLUTTER_PLUGIN_IMPL
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
#else
#define FLUTTER_PLUGIN_EXPORT
#endif

#if defined(__cplusplus)
extern "C" {
#endif

FLUTTER_PLUGIN_EXPORT void TizenLogPluginRegisterWithRegistrar(
FlutterDesktopPluginRegistrarRef registrar);

#if defined(__cplusplus)
} // extern "C"
#endif

#endif // FLUTTER_PLUGIN_TIZEN_LOG_PLUGIN_H_
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions packages/tizen_log/tizen/project_def.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://docs.tizen.org/application/tizen-studio/native-tools/project-conversion
# for details.

APPNAME = tizen_log_plugin
type = staticLib
profile = common-5.5

# Source files
USER_SRCS += src/*.cc

# User defines
USER_DEFS =
USER_UNDEFS =
USER_CPP_DEFS = FLUTTER_PLUGIN_IMPL
USER_CPP_UNDEFS =

# User includes
USER_INC_DIRS = inc src
USER_INC_FILES =
USER_CPP_INC_FILES =

# User libraries
USER_LIB_DIRS += lib/${BUILD_ARCH}
USER_LIBS += ftpw_tizen_log
7 changes: 7 additions & 0 deletions packages/tizen_log/tizen/src/tizen_log_plugin.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "tizen_log_plugin.h"

void TizenLogPluginRegisterWithRegistrar(FlutterDesktopPluginRegistrarRef) {}
Loading