{"id":2436,"date":"2015-05-13T21:26:25","date_gmt":"2015-05-13T13:26:25","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=2436"},"modified":"2015-05-14T14:12:01","modified_gmt":"2015-05-14T06:12:01","slug":"fmx-%e4%bd%bf%e7%94%a8%e6%97%a5%e5%bf%97%e8%b0%83%e8%af%95%e8%b7%9f%e8%b8%aa%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=2436","title":{"rendered":"[FMX] \u4f7f\u7528\u65e5\u5fd7\u8c03\u8bd5\u8ddf\u8e2a\u7a0b\u5e8f"},"content":{"rendered":"<p>\u53ef\u80fd\u8bb8\u591a\u4eba\u8c61\u6211\u4e00\u6837\u6ca1\u6709\u6ce8\u610f\u5230\uff0cFMX.Types \u63d0\u4f9b\u4e86\u4e00\u4e2a\u8c03\u8bd5\u65e5\u5fd7\u7684\u7ba1\u7406\u7c7b\uff0c\u7528\u6765\u5728\u7a0b\u5e8f\u4e2d\u8f93\u51fa\u65e5\u5fd7\u3002<\/p>\n<ul>\n<li>Windows \u4e0b\uff0c\u65e5\u5fd7\u88ab\u4f7f\u7528 OutputDebugString \u4e00\u6837\uff0c\u8f93\u51fa\u5230\u8c03\u8bd5\u5668\u7684 Event Log \u91cc<\/li>\n<li>Android \u4e0b\uff0c\u65e5\u5fd7\u88ab\u8f93\u51fa\u7ed9LogCat\uff0c\u4f60\u53ef\u4ee5\u7528Android \u5e73\u53f0 SDK \u7684tools \u76ee\u5f55\u4e0b\u7684 monitor.bat \u6765\u6253\u5f00 Android Device Monitor \u5de5\u5177\u6765\u67e5\u770b\u65e5\u5fd7\u3002<a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/AndroidDeviceMonitor.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2439\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/AndroidDeviceMonitor-1024x678.jpg\" alt=\"AndroidDeviceMonitor\" width=\"1024\" height=\"678\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/AndroidDeviceMonitor.jpg 1024w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/AndroidDeviceMonitor-300x199.jpg 300w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/li>\n<\/ul>\n<p>\u5982\u679c\u6ca1\u6709\u7279\u6b8a\u6307\u5b9a\uff0cmonitor.bat \u5e94\u8be5\u4f4d\u4e8e C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\16.0\\PlatformSDKs\\android-sdk-windows\\tools \u76ee\u5f55\u4e0b\u3002<\/p>\n<ul>\n<li>iOS \u9700\u8981\u5230 xcode \u7684 Organizer \u91cc\u7684Console \u67e5\u770b\u65e5\u5fd7\uff0c\u8bf7\u53c2\u8003\uff1ahttp:\/\/www.th7.cn\/Program\/IOS\/2012\/03\/09\/62910.shtml<\/li>\n<li>OSX \u597d\u8c61\u9700\u8981\u5230\u63a7\u5236\u53f0\u53bb\u67e5\u770b\u65e5\u5fd7\u3002<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/osxlog.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2455\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/osxlog.png\" alt=\"osxlog\" width=\"600\" height=\"361\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/osxlog.png 600w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/05\/osxlog-300x181.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u5728\u7a0b\u5e8f\u4e2d\uff0c\u8bb0\u5f55\u65e5\u5fd7\u5b9e\u9645\u4e0a\u5728\u5f15\u7528 FMX.Types \u540e\uff0c\u5c31\u5f88\u7b80\u5355\u4e86\uff0c\u53ea\u9700\u8981\u4e00\u53e5\u8bdd\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">procedure TForm3.FormCreate(Sender: TObject);\r\nbegin\r\nLog.d('Hello,world');\r\nend;<\/pre>\n<p>\u5f53\u7136\uff0c\u5b83\u8fd8\u6709\u51e0\u4e2a\u65b9\u6cd5\uff0c\u5927\u5bb6\u770b\u4e0b\u58f0\u660e\u5c31\u4e00\u76ee\u4e86\u7136\u4e86\uff0c\u4ffa\u4e0d\u5c31\u5570\u55e6\u51d1\u5b57\u6570\u4e86\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">    \/\/\/ &lt;summary&gt;Log a debug message. Same arguments as Format.&lt;\/summary&gt;\r\n    class procedure d(const Fmt: string; const Args: array of const); overload;\r\n    \/\/\/ &lt;summary&gt;Log a simple debug message.&lt;\/summary&gt;\r\n    class procedure d(const Msg: string); overload; inline;\r\n    \/\/\/ &lt;summary&gt;Log a debug message with Tag, object data of Instance, Method that invokes the logger and message Msg.\r\n    \/\/\/ &lt;\/summary&gt;\r\n    class procedure d(const Tag: string; const Instance: TObject; const Method, Msg: string); overload; inline;\r\n    \/\/\/ &lt;summary&gt;Log a debug message with Tag, object data of Instance and a message Msg&lt;\/summary&gt;\r\n    class procedure d(const Tag: string; const Instance: TObject; const Msg: string); overload; inline;\r\n    \/\/\/ &lt;summary&gt;Log a time stamp with message Msg&lt;\/summary&gt;\r\n    class procedure TimeStamp(const Msg: string); overload;\r\n    \/\/\/ &lt;summary&gt;Perform a timed execution of Func and print execution times, return function result.\r\n    \/\/\/ Proc receives a parameter TLogToken which can be used to mark specific points where timestamps should be taken\r\n    \/\/\/ in addition to complete procedure time.&lt;\/summary&gt;\r\n    class function Trace&lt;TResult&gt;(const Tag: string; const Func: TFunc&lt;TLogToken, TResult&gt;;\r\n      const Threshold: Integer = -1): TResult; overload;\r\n    \/\/\/ &lt;summary&gt;A convenience variant of Trace&lt;TResult&gt; when token is not needed.&lt;\/summary&gt;\r\n    class function Trace&lt;TResult&gt;(const Tag: string; const Func: TFunc&lt;TResult&gt;; const Threshold: Integer = -1): TResult; overload;\r\n    \/\/\/ &lt;summary&gt;A convenience variant of Trace&lt;TResult&gt; for procedures.&lt;\/summary&gt;\r\n    class procedure Trace(const Tag: string; const Proc: TProc&lt;TLogToken&gt;; const Threshold: Integer = -1); overload;\r\n    \/\/\/ &lt;summary&gt;A convenience variant of Trace&lt;TResult&gt; for procedures when token is not needed.&lt;\/summary&gt;\r\n    class procedure Trace(const Tag: string; const Proc: TProc; const Threshold: Integer = -1); overload;\r\n    \/\/\/ &lt;summary&gt;Get a basic string representation of an object, consisting of ClassName and its pointer&lt;\/summary&gt;\r\n    class function ObjToString(const Instance: TObject): string;\r\n    \/\/\/ &lt;summary&gt;Get a string representation of array using MakeStr function to convert individual elements.&lt;\/summary&gt;\r\n    class function ArrayToString(const AArray: TEnumerable&lt;TFmxObject&gt;; const MakeStr: TToStringFunc): string; overload;\r\n    \/\/\/ &lt;summary&gt;Get a string representation of array using TObject.ToString to convert individual elements.&lt;\/summary&gt;\r\n    class function ArrayToString(const AArray: TEnumerable&lt;TFmxObject&gt;): string; overload;\r\n    \/\/\/ &lt;summary&gt;Dump complete TFmxObject with all its children.&lt;\/summary&gt;\r\n    class procedure DumpFmxObject(const AObject: TFmxObject; const Nest: Integer = 0);<\/pre>\n<p>\u5b9e\u9645\u4e0a\uff0c\u5728 VCL \u7a0b\u5e8f\u4e0b\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5f15\u7528 FMX.Types \u5355\u5143\uff0c\u7136\u540e\u518d\u8c03\u7528 Log.d \u51fd\u6570\u6765\u8bb0\u5f55\u65e5\u5fd7\u3002<\/p>\n<p>\u6700\u540e\uff0c\u4e2a\u4eba\u5efa\u8bae\u60a8\u4f7f\u7528 QLog \u8bb0\u5f55\u65e5\u5fd7\uff0c\u7b80\u5355\u6613\u7528\u8de8\u5e73\u53f0\uff0c\u800c\u4e14\u65e5\u5fd7\u53ef\u4ee5\u8fd8\u652f\u6301 SyslogD \u534f\u8bae\uff0c\u65e5\u5fd7\u7684\u8f93\u51fa\u9014\u5f84\u591a\u6837\uff0c\u6587\u4ef6\u3001\u63a7\u5236\u53f0\u3001SyslogD \u517c\u5bb9\u7684\u8fdc\u7a0b\u65e5\u5fd7\u670d\u52a1\u5668\u90fd\u53ef\u4ee5\uff0c\u6587\u4ef6\u65e5\u5fd7\u652f\u6301\u81ea\u52a8\u5206\u5377\u538b\u7f29\uff0c\u8fd8\u53ef\u4ee5\u81ea\u884c\u5b9e\u73b0\u66f4\u591a\u7684 TQLogWriter\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53ef\u80fd\u8bb8\u591a\u4eba\u8c61\u6211\u4e00\u6837\u6ca1\u6709\u6ce8\u610f\u5230\uff0cFMX.T [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,21],"tags":[149,137],"class_list":["post-2436","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-misc","tag-fmx","tag-137"],"views":4085,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2436"}],"version-history":[{"count":6,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2436\/revisions"}],"predecessor-version":[{"id":2457,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2436\/revisions\/2457"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}