logzomg 0.1.0.3 → 0.1.0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01d7f3d7a0dfe9f6bb85c8dc8671b4451d74d77b
4
- data.tar.gz: b6ed5e5d89e9861b0a17c0b24ac13461cd4df0a9
3
+ metadata.gz: 3edce9006c7d9c5d0fb96daa8671efffd8693819
4
+ data.tar.gz: 177c2829fa844c7ce3cd52288b309281e34e183e
5
5
  SHA512:
6
- metadata.gz: cab7809cdf3d8a2c2aa88b8b8fd6f588f347d0a67d6d5e2612bb3b7417b0a9188d2d6d75506504cd725be3c6cc152a19b82148e96ca364a056acc03a10671286
7
- data.tar.gz: 976856d41dfaa8203f90dd314528a00428064b6ffb3290c97533f4fb6f865a202b0b2e51e0e0ba62510f2da7c3426a2c41e1c9c434d9de8755e27f332397a431
6
+ metadata.gz: e79975670e86e61d65629da16c9bc4c85971e111ccf469e756a38873c0b4a1b6a8037eabd9fdebda2b18c72b571efa4fc705038dc29de5c9fb54251d6893b69d
7
+ data.tar.gz: 4f6872fa4d8085c88a5164cc64e62590fc578cf0dfe6588a9e086df0803b89628a1881452a743010b3c52b8df6dae853674424c413a29aa9c7b9e90a3acbc268
@@ -1,3 +1,3 @@
1
1
  module Logzomg
2
- VERSION = "0.1.0.3"
2
+ VERSION = "0.1.0.3.1"
3
3
  end
data/lib/logzomg.rb CHANGED
@@ -4,15 +4,16 @@ require "logzomg/version"
4
4
  module Logzomg
5
5
  class Logger
6
6
  # TODO change this to proper file path
7
- LOG_PATH = File.expand_path(Rails.root.join('logs',__FILE__))
8
7
  LEVELS = ['debug','info','warning','error','fatal']
9
8
 
10
9
  UnsupportedType = Class.new(StandardError)
11
10
  UnsupportedLevel = Class.new(StandardError)
12
11
 
12
+ attr_accessor :log_path
13
+
13
14
  def initialize(**args, &block)
14
15
  # Set some default values
15
- puts LOG_PATH
16
+ @log_path = File.expand_path(get_path + '/log/')
16
17
  @level = args[:level] ? args[:level] : "warning"
17
18
  @formatter = args[:formatter] ? args[:formatter] : TextFormatter.new {|f| f.with_color = true}
18
19
  if block_given?
@@ -96,9 +97,13 @@ module Logzomg
96
97
  # If given one in hash[:file] use that
97
98
  def write(hash, msg)
98
99
  file = hash.has_key?(:file) ? "/" + hash[:file] : '/log.txt'
99
- File.open(LOG_PATH + file, 'a') {|f| f.write(msg) }
100
+ File.open(@log_path + file, 'a') {|f| f.write(msg) }
100
101
  end
101
102
 
103
+ def get_path
104
+ Dir.pwd
105
+ end
106
+
102
107
  # Checks if message is hash
103
108
  def valid_hash?(hash)
104
109
  return hash.class == Hash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logzomg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.3
4
+ version: 0.1.0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rasmus