GrijjyCloudLogger, remote logging for Windows, iOS, Android, macOS and Linux by Allen Drennan
August 22, 2017 Allen Drennan
August 22, 2017 Allen Drennan
[SHOWTOGROUPS=4,20]
GrijjyCloudLogger is a remote logging tool that allows you to send log messages over the Intranet or Internet from Windows, Linux, iOS, Android and macOS devices to a viewer running on Windows. Besides sending messages along with any data, it has numerous features including custom live watches, remote live views of objects, tracking live memory usage, object allocations, growth leaks and more.
Here at Grijjy we use this tool on a daily basis to help us diagnose run-time related issues with our applications running on various platforms. Our logger helps us easily examine the run-time state of our application running on iOS and Android devices, which can be difficult using the debugger or mobile platform specific logging features. We developed this utility because we needed a high-performance remote logger that worked on all platforms and operating systems and we wanted unified, run-time debug related capabilities like memory and object tracking from these respective platforms.
Being able to analyze the run-time of your application using your Windows desktop, where your IDE already resides, is a powerful tool in your arsenal as a developer. We hope you find it useful.
The GrijjyCloudLogger is built upon our Для просмотра ссылки Войдиили Зарегистрируйся that allows you to create powerful, lightweight, distributed applications that can route messages over any network, including the Internet. It is extremely fast over the network and can handle numerous connected developers simultaneously. It also uses our Для просмотра ссылки Войди или Зарегистрируйся that allows us to encapsulate extensible and arbitrary data and transport the data using efficient payloads.
Getting Started
To use GrijjyCloudLogging in your Delphi project all you need to do is include the Grijjy.CloudLogging unit in your uses list. You should also run the GrijjyLogBroker.exe to route messages and the GrijjyLogViewer.exe to view messages. These Для просмотра ссылки Войдиили Зарегистрируйся.
To send messages simply use one of the many provided GrijjyLog.Send() methods.
Sending data using Grijjy Cloud Logger
The Grijjy Cloud Logger provides various overloaded Send() methods to remotely send data over the network to the GrijjyLogViewer. Besides the basic data types, the Grijjy Cloud Logger support sending of advanced data types including TStrings, Memory Pointers, TBytes and even TObjects.
Each of the various Send() methods has common parameters, namely AMsg parameter which is always a string that is displayed in the Log Viewer Messages frame. The AValue is the actual data of various overloaded types. You can also send an optional TgoLogLevel parameter indicating the severity of the message. Lastly an optional parameter called the Service name. The Service name indicates who is sending the message so the Log Broker can properly route the message to the intended Log Viewer (more on this topic later).
Common types
Most of the basic data types are supported by passing the data directly to the Send() method.
TStrings
TStrings can be sent over the cloud logger as well by simply constructing a TStringList and calling the overloaded Send() method.
TBytes
Grijjy Cloud Logger provides several methods to display blocks of memory. In this example we send a TBytes object to the remote viewer.
Data Pointers
The second approach to sending blocks of memory over the cloud logger is to use the Send() method with a Pointer to a memory location and a Size in bytes.
TObject
TObjects can be sent along with all of the objects fields and properties. You can choose whether only public and published fields are shown or all protected and private fields as well. Optionally you can also choose how many subfield levels are sent for the various fields and properties.
The GrijjyCloudLogger contains method helpers that allow you to more easily view when methods are entered and exited. EnterMethod logs the start of a method block. Subsequent Send() calls to Log will be treated as part of this method, until ExitMethod is called.
[/SHOWTOGROUPS]
GrijjyCloudLogger is a remote logging tool that allows you to send log messages over the Intranet or Internet from Windows, Linux, iOS, Android and macOS devices to a viewer running on Windows. Besides sending messages along with any data, it has numerous features including custom live watches, remote live views of objects, tracking live memory usage, object allocations, growth leaks and more.
Here at Grijjy we use this tool on a daily basis to help us diagnose run-time related issues with our applications running on various platforms. Our logger helps us easily examine the run-time state of our application running on iOS and Android devices, which can be difficult using the debugger or mobile platform specific logging features. We developed this utility because we needed a high-performance remote logger that worked on all platforms and operating systems and we wanted unified, run-time debug related capabilities like memory and object tracking from these respective platforms.
Being able to analyze the run-time of your application using your Windows desktop, where your IDE already resides, is a powerful tool in your arsenal as a developer. We hope you find it useful.
The GrijjyCloudLogger is built upon our Для просмотра ссылки Войди
Getting Started
To use GrijjyCloudLogging in your Delphi project all you need to do is include the Grijjy.CloudLogging unit in your uses list. You should also run the GrijjyLogBroker.exe to route messages and the GrijjyLogViewer.exe to view messages. These Для просмотра ссылки Войди
1 | uses Grijjy.CloudLogging; |
1 | GrijjyLog.Send('String value', 'Foo'); |
Sending data using Grijjy Cloud Logger
The Grijjy Cloud Logger provides various overloaded Send() methods to remotely send data over the network to the GrijjyLogViewer. Besides the basic data types, the Grijjy Cloud Logger support sending of advanced data types including TStrings, Memory Pointers, TBytes and even TObjects.
Each of the various Send() methods has common parameters, namely AMsg parameter which is always a string that is displayed in the Log Viewer Messages frame. The AValue is the actual data of various overloaded types. You can also send an optional TgoLogLevel parameter indicating the severity of the message. Lastly an optional parameter called the Service name. The Service name indicates who is sending the message so the Log Broker can properly route the message to the intended Log Viewer (more on this topic later).
Common types
Most of the basic data types are supported by passing the data directly to the Send() method.
1 2 3 4 | GrijjyLog.Send('String value', 'Foo'); // strings GrijjyLog.Send('Integer value', 42); // integer GrijjyLog.Send('Boolean value', True); // boolean GrijjyLog.Send('Float value', Pi); // extended |
TStrings
TStrings can be sent over the cloud logger as well by simply constructing a TStringList and calling the overloaded Send() method.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var S: TStringList; begin S := TStringList.Create; try S.Add('Foo'); S.Add('With Spaces'); S.Add('With, Commas'); S.Add('With "Quotes"'); S.Add('With ''Quotes'''); S.Add('Width , "every", ''thing'''); GrijjyLog.Send('TStrings value', S, TgoLogLevel.Warning); finally S.Free; end; end; |
TBytes
Grijjy Cloud Logger provides several methods to display blocks of memory. In this example we send a TBytes object to the remote viewer.
1 2 3 4 5 6 7 | var Bytes: TBytes; begin Bytes := TEncoding.UTF8.GetBytes ('The Quick Brown Fox Jumps Over The Lazy Dog'); GrijjyLog.Send('TBytes value', Bytes, TgoLogLevel.Warning); end; |
Data Pointers
The second approach to sending blocks of memory over the cloud logger is to use the Send() method with a Pointer to a memory location and a Size in bytes.
1 2 3 4 5 6 7 8 9 10 | var Bytes: TBytes; I: Integer; begin SetLength(Bytes, 997); for I := 0 to Length(Bytes) - 1 do Bytes := Random(256); Bytes[10] := 0; GrijjyLog.Send('Memory value', @Bytes[0], Length(Bytes), TgoLogLevel.Warning); end; |
TObject
TObjects can be sent along with all of the objects fields and properties. You can choose whether only public and published fields are shown or all protected and private fields as well. Optionally you can also choose how many subfield levels are sent for the various fields and properties.
1 | GrijjyLog.Send('Object value', Self, mvPublic, 4, TgoLogLevel.Warning); |
Nested methodsNote that this can potentially be a slow and bandwidth-intensive call since RTTI is used to query the object, and it may result in large data loads depending on the AMinVisibility and AMaxNesting parameters.
The GrijjyCloudLogger contains method helpers that allow you to more easily view when methods are entered and exited. EnterMethod logs the start of a method block. Subsequent Send() calls to Log will be treated as part of this method, until ExitMethod is called.
1 2 3 4 5 6 7 8 9 10 11 12 13 | var Foo: TSampleFoo; begin Foo := TSampleFoo.Create; try GrijjyLog.EnterMethod(Self, 'ButtonMethodClick'); GrijjyLog.Send('Inside TFormMain.ButtonMethodClick', TgoLogLevel.Info); Foo.SomeMethod; GrijjyLog.ExitMethod(Self, 'ButtonMethodClick'); finally Foo.Free; end; end; |
[/SHOWTOGROUPS]