Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
4e19706
Add git files, composer and license
Nov 10, 2014
ae668e0
Initial commit: forming log objects, common logic and Monolog formatter
Nov 10, 2014
e63c95f
A bit of refactoring: move common methods to abstract implementation
Nov 10, 2014
8bc2105
Add standalone direct logger with protocol stub
Nov 10, 2014
74aec18
Temporary add log4php layout to common repository
Nov 10, 2014
92d4604
Add TODO about stack-trace (waiting for more info)
Nov 10, 2014
75dd4e1
Add testing scripts for both CLI and web-server modes
Nov 10, 2014
40d0261
Add documentation TODO
Nov 10, 2014
3feee37
Gather WebRequestDetail only once (make it singleton)
Nov 12, 2014
ba80bce
Minor refactoring: implement error setter and remove duplicated code
Nov 12, 2014
3bb190c
Add one more TODO for future implementation
Nov 12, 2014
287cd91
Add one more TODO for future implementation (recurrent exceptions)
Nov 12, 2014
1b8d50c
Replace environment variables by server variables in run scripts
Nov 12, 2014
f7ec6aa
Rename namespace for API entities
Nov 12, 2014
6bda17e
Refactoring: create log entry objects, each specific for each support…
Nov 12, 2014
4bae382
Get rid of syslog-specific stuff
Nov 12, 2014
01a49ef
Add string exceptions support
Nov 13, 2014
9b95cea
Improve coding style
Nov 13, 2014
b751f1e
Add error type and remove some TODOs
Nov 13, 2014
fb7aede
Refactoring: create error wrapper and remove duplicated code
Nov 13, 2014
d7a0cdf
Limit nested exceptions
Nov 13, 2014
70d4a75
Add backtrace TODO (must be checked before release)
Nov 13, 2014
62d289f
Add classes description and a bit of refactoring
Nov 13, 2014
0ef80ec
Use namespaces for log4php implementation
Nov 13, 2014
c179b2b
Remove message builders hierarchy - now only one message builder exists
Nov 13, 2014
2e9834e
Add appName parameter and replace Monolog formatter by Monolog handler
Nov 13, 2014
6d21a2d
Replace log4php layout by appender
Nov 13, 2014
364bbfd
Add environment details
Nov 13, 2014
5c24c9f
Add transports hierarchy
Nov 13, 2014
a6557e1
Add environment name support
Nov 13, 2014
71e8654
Add new transport entities and improve message builder
Nov 14, 2014
2283864
Refactor transport base classes and stub implementation
Nov 14, 2014
d2042e0
Implement default transport
Nov 14, 2014
f3ed8ec
Add TCP connection testing script
Nov 14, 2014
33b98b8
Return real milliseconds instead of seconds
Nov 14, 2014
1feb467
Add transports support to Monolog handler
Nov 14, 2014
557cd0e
Internal error logging
Nov 14, 2014
f8c4939
Transports refactoring
Nov 17, 2014
a4e9d36
Change error log message
Nov 17, 2014
590c712
API transports stubs
Nov 17, 2014
d0e0354
Implement background curl transport
Nov 17, 2014
29c3f8f
Implement CurlTransport stub
Nov 17, 2014
a255a3c
Send null instead empty array for lists in JSON
Nov 18, 2014
e9358e0
Rename log file
Nov 18, 2014
f2c5178
Rename API entities and add LogMsgGroup
Nov 18, 2014
fc30c0e
Use real API call instead of stubs for Curl transport
Nov 18, 2014
b0885a7
Replace stubs for Exec transport
Nov 18, 2014
6172a70
Fix stacktrace for core errors: we do not know method name, but UI do…
Nov 18, 2014
08519af
Fix context for core errors: remove already used data
Nov 18, 2014
5f5fe90
Handle shutdown cases: sometimes destructor is not called
Nov 18, 2014
cfc5ad6
Add more required fields to SenderInfo
Nov 19, 2014
01ebeae
Improve internal logging
Nov 19, 2014
01a091a
Add transport script to monolog runner
Nov 19, 2014
c7bd163
Fix line-endings to UNIX ones
Nov 19, 2014
9c2a336
Check "exec" availability
Nov 19, 2014
0aa8d1a
Add transports support for log4php logger
Nov 19, 2014
06979b8
Remove runners from master
Nov 19, 2014
13e43c3
Fix getcwd() issue - now current working directory is a state of Envi…
Nov 20, 2014
2861083
Do not limit nesting level of exceptions
Nov 20, 2014
e3d686c
Set final configuration for agent transport
Nov 20, 2014
b4e35ad
Fix some TODOs
Nov 20, 2014
fb1da45
Add API key validation
Nov 20, 2014
d1fa257
Make environment name optional
Nov 20, 2014
49efd56
Add appName and apiKey validation for log4php appender
Nov 20, 2014
bca85fa
Fix log4php appender issue: method call of non-existing object
Nov 20, 2014
0de59e5
Improve stack-trace: add class names and namespaces, add type of meth…
Nov 21, 2014
ff8d23f
Remove test packages, add keywords
Nov 21, 2014
3f8103e
Test markdown for monolog
Nov 21, 2014
ab735a0
Readme for monolog (not finished)
Nov 21, 2014
a65fb91
Refactoring: extract BuilderInterface and add empty implementation. S…
Nov 24, 2014
6996dff
Fix empty environment details
Nov 24, 2014
f4e20ce
Add options description
Nov 24, 2014
5659f85
Try YML comment in markdown
Nov 24, 2014
368dce1
Add troubleshooting description
Nov 24, 2014
1bb3f4d
Change options subheading level
Nov 24, 2014
0d1b93d
Add YML comments
Nov 24, 2014
0f709ba
Modify main composer.json file and add composer.json for internal pac…
Nov 25, 2014
739dda9
Remove unused reference
Nov 25, 2014
653b40d
Add port option to doc
Nov 25, 2014
ae2b628
Make SenderInfo fields consistent with Environment details (current w…
Nov 25, 2014
3786553
Make options generic for all transports and add "port" option to Agen…
Nov 25, 2014
27677e1
Add port support for log4php appender
Nov 25, 2014
0790dbc
Add curlPath support for log4php appender
Nov 25, 2014
160b72b
Add log4php README
Nov 25, 2014
85939ab
Attempt to fix XML-config in markdown
Nov 25, 2014
35e7ebc
Fix XML formatting in markdown
Nov 25, 2014
6cb2188
Remove XML-mention from markdown to fix layout
Nov 25, 2014
fd643e2
Make XML example single-line in markdown to fix layout
Nov 25, 2014
d253a67
Fix XML indentation in markdown to fix layout
Nov 25, 2014
5d709d2
Add exception example to log4php doc and add separate Monolog readme
Nov 25, 2014
6bdf952
Add simple description for common libraries package
Nov 25, 2014
d630c5b
Fix too long lines in the markdown file
Nov 25, 2014
b246686
Add Apache 2.0 license files
Nov 25, 2014
1e55d1b
Add copyright and year
Nov 25, 2014
d73128d
Fix homepage in composer.json
Nov 25, 2014
0932744
fix spelling in readme
Nov 25, 2014
eb21540
Add argument length limit for ExecTransport
Nov 27, 2014
a2162bd
Add error governor functionality
Nov 27, 2014
3936731
Change logic for duplicated errors: send plain messages, but unset er…
Dec 4, 2014
d287d17
Set production API URL
Dec 5, 2014
c08d498
Divide common/monolog/log4php libraries
Dec 25, 2014
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
202 changes: 202 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2014 Stackify

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
stackify-log-php
stackify-api-php
================

Stackify Log API for PHP
Common libraries for [Stackify Monolog handler](https://github.com/stackify/stackify-log-monolog) and [Stackify log4php appender](https://github.com/stackify/stackify-log-log4php).
This package also includes a standalone [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) -compatible logger that can be used without third-party libraries.

Errors and Logs Overview:
http://docs.stackify.com/m/7787/l/189767

Sign Up for a Trial:
http://www.stackify.com/sign-up/

## Standalone logger
Install the latest version with `composer require stackify/logger`

```php
use Stackify\Log\Standalone\Logger;

$logger = new Logger('appname.com');
$logger->warning('something happened');
try {
$db->connect();
catch (DbException $ex) {
$logger->error('DB is not available', ['ex' => $ex]);
}
```

By default handler requires [Stackify agent](https://stackify.screenstepslive.com/s/3095/m/7787/l/119709-installation-for-linux) to be running.
There are other ways to send data, read more in [Monolog package documentation](https://github.com/stackify/stackify-log-monolog),
all transports are available for standalone logger as well.


## License

Copyright 2014 Stackify, LLC.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
17 changes: 17 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "stackify/logger",
"description": "Stackify logs and errors for PHP",
"keywords": ["log", "logging", "psr-3", "stackify", "monolog", "log4php"],
"homepage": "https://github.com/stackify/stackify-api-php",
"type": "library",
"license": "Apache-2.0",
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"autoload": {
"psr-4": {
"Stackify\\": "src/Stackify"
}
}
}
5 changes: 5 additions & 0 deletions src/Stackify/Exceptions/InitializationException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace Stackify\Exceptions;

class InitializationException extends StackifyException {}
5 changes: 5 additions & 0 deletions src/Stackify/Exceptions/StackifyException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace Stackify\Exceptions;

class StackifyException extends \Exception {}
27 changes: 27 additions & 0 deletions src/Stackify/Log/Builder/BuilderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Stackify\Log\Builder;

use Stackify\Log\Entities\Api\LogMsg;
use Stackify\Log\Entities\LogEntryInterface;

interface BuilderInterface
{

/**
* @return string Formatted JSON
*/
public function getAgentMessage(LogMsg $logMsg);

/**
* @param \Stackify\Log\Entities\Api\LogMsg[] $logMsgs
* @return string Formatted JSON
*/
public function getApiMessage(array $logMsgs);

/**
* @return \Stackify\Log\Entities\Api\LogMsg
*/
public function createLogMsg(LogEntryInterface $logEntry);

}
Loading