UserLog 
UserLog is an Automation Studio library with functions for writing to logbooks synchronously. UserLog's simple one-line functions provide a necessary tool for software development and debug.
NOTE: This is not an official library. UserLog is provided as is under the GNU GPL v3.0 license agreement. Support for this library is provided through the GitHub Issues List.
Installation
- Download and extract the archive
- Import the UserLog package to your Automation Studio project's Logical View using Existing Library from the toolbox
Features
- Synchronously write to user logbooks
- Timestamp is recorded at the time of the function call
- Parameters
- Event ID
- Severity: Debug, Success, Info, Warning, Error, Critical
- NOTE: Debug and Critical are extentions of ArEventLog severities
- Facility 0..4095
- Code 0..65535
- Severity: Debug, Success, Info, Warning, Error, Critical
- Origin record ID for hierarchy
- Object name
- Message
- Format message with runtime data (%b, %f, %i, %s)
- Event ID
- Automatically read software object name
- Set severity level to suppress messages
- Error messages written to the User logbook
- String truncation to protect overflow
- Create custom logbooks
- Compatible with text system
Functions
| Function | Description |
|---|---|
| UserLogBasic | Write to the User logbook synchronously |
| UserLogAdvanced | Write to the User logbook with runtime data |
| UserLogCustom | Write to any user logbook synchronously |
| UserLogEventText | Write to any user logbook through binary-encoded data and event texts |
| UserLogCreate | Create a custom logbook in an Init subroutine |
| UserLogSetSeverityLevel | Suppress messages below the input level and return previous level |
| UserLogGetSeverity | Get ArEventLog severity from an event ID |
| UserLogGetFacility | Get ArEventLog facility from an event ID |
| UserLogGetCode | Get ArEventLog code from an event ID |
Clone
Clone to a reference location.
git clone https://github.com/tmatijevich/UserLog.git
Or, add as a submodule to your project's libraries.
cd <project_root>
git submodule add https://github.com/tmatijevich/UserLog.git <project_root>/Logical/Libraries/UserLog
Then add as an existing library from the Automation Studio toolbox.
Build
Building a project with this package may result in warnings for additional files.
In Automation Studio 4.11+, it is possible to add specific filters to warnings 9232 and 9233. Navigate to Configuration View, right-click the PLC object and select properties, chose the Build tab, and add the follow text to the "Objects ignored for build warnings 9232 and 9233" field. The filters are case sensitive.
*README*;*LICENSE*;.git;.gitignore;.github
Prior to Automation Studio 4.11, it is possible to suppress all build warnings regarding additional files by using -W 9232 9233 in the "Additional build options" field.
Dependencies
ArEventLogAsBrStrsys_lib
