Skip to content

Commit

Permalink
Merge branch 'release-0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Djonua committed Nov 10, 2016
2 parents c3c3591 + 5fac718 commit 0798ecc
Show file tree
Hide file tree
Showing 24 changed files with 3,625 additions and 0 deletions.
108 changes: 108 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/
## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Eclipse template

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/
### Yii template
assets/*
!assets/.gitignore
protected/runtime/*
!protected/runtime/.gitignore
protected/data/*.db
themes/classic/views/
### Vim template
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags
### NetBeans template
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
.nb-gradle/
### composer template
vendor/
### codeception
tests/_output/*
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: php
php:
- '5.6'
- '7.0'
- hhvm
sudo: false
cache:
- vendor
- $HOME/.composer/cache
install:
- travis_retry composer self-update
- travis_retry composer global require fxp/composer-asset-plugin
- travis_retry composer install --prefer-dist --no-interaction
script:
- composer exec codecept run --verbose
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CHANGELOG

10.11.2016: 0.9.0 release
- php 5.6 supports
- php 7.0 supports
- HHVM supports
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
yii2-graylog-target
===

###### Graylog2 log target for Yii2 framework applications

## Installation

For installation the yii2-graylog-target library in your projects as composer dependency,
run the command:

`php composer.phar require "devgroup/yii2-graylog-target:*"`

... or just add to composer.json file the following line:

```text
"devgroup/yii2-graylog-target": "*"
```

## Configuration

Configure from config array

```php
'components' => [
'log' => [
'grayii' => [
'transport' => [
'class' => \Gelf\Transport\HttpTransport::class,
'host' => 'http://graylog2-server.com',
'port' => 12201,
],
'appName' => 'app name',
]
]
]
```

##### Available config parameters:

**Param key**|**Optional**|**Default value**|**Description**
-------------|------------|-----------------|---------------
`transport`|+|Gelf\Transport\HttpTransport|Transport config array for publishing a message to Graylog2 server
`publisher`|+|Gelf\Publisher|Publisher config array
`messageValidator`|+|Gelf\MessageValidator|Message validator class for publisher
`container`|+|\Yii::$container|DI container
`version`|+|1.1|GELF spec version
`appName`|+|ID of the application|Category name for log message

## Usage

- Sent additional data:

```php
Yii::info([
'short' => 'Short message or title', // required. alternate usage variant: `Short message or title` (without a key 'short', but first item in array)
'full' => 'Full message', // optional. full message of log. For example, may be a stack trace as string or other detalized message
'_field1' => 'value1', // optional. additional field starts with '_' symbol
'_field2' => 'value2', // optional. additional field starts with '_' symbol
]);
```

- Sent exception:

```php
try {
... running code with harmful bugs...
} catch (\Throwable $t) {
Yii::warning($t);
}
```
- Sent short message:

```php
Yii::trace('The short message example'); // or equivalent usage is Yii::trace(['The short message example']);
```

## Tests

Tests was placed int the **test** directory. Tests can be running by the command:

`php composer.phar exec codecept run`

## Tests with different php versions with docker:

- PHP v5.6

`docker run -it --rm --name php56-for-grayii-tests -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:5.6-cli php vendor/bin/codecept run`

- PHP v7.0

`docker run -it --rm --name php70-for-grayii-tests -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.0-cli php vendor/bin/codecept run`

- HHVM

`docker run -it --rm --name hhvm-for-grayii-tests -v "$PWD":/usr/src/myapp -w /usr/src/myapp diegomarangoni/hhvm:cli hhvm vendor/bin/codecept run`
25 changes: 25 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
enabled:
- Yii2
config:
Yii2:
configFile: tests/config/test.php
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "devgroup/yii2-graylog-target",
"description": "Graylog2 log target for Yii2 framework applications",
"keywords": ["Yii2", "Graylog", "target", "log"],
"type": "library",
"license": "BSD",
"authors": [
{
"name": "Kirill Djonua",
"email": "[email protected]"
}
],
"minimum-stability": "stable",
"require": {
"php": ">=5.5",
"yiisoft/yii2": "~2.0",
"graylog2/gelf-php": "~1.5",
"psr/log": "~1.0.2"
},
"require-dev": {
"codeception/codeception": "^2.2"
},
"autoload": {
"psr-4": {
"devgroup\\grayii\\": "src/"
}
}
}
Loading

0 comments on commit 0798ecc

Please sign in to comment.